Swap.js

Swap.js is an extremely tiny, less than 2KB (less than 600 bytes gzipped) barebones JS utility that simply gives you a way to swap classes between a collection of items. It sets one item active at a time while preparing next one for the ride and remembering the previous item. It offers the right amount of methods to move, select and update.

What can you do with it?

  • A slider.

    Give items some classes and you're done.

        <div class="list">
            <div class="item">First</div>
            <div class="item">Second</div>
            <div class="item">Third</div>
        </div>
  • A multi stage form
  • A slideshow