JSFiddle - React, Tailwind, and code Playground

by joelpurra

HTML

<script src="https://raw.github.com/razorjack/quicksand/master/jquery.quicksand.js"></script>
<div class="demo">
    <ul class="colors all">
      <li id="c463033" style="background: #463033"></li>
      <li id="c77343d" style="background: #77343d"></li>
      <li id="ce83f2f" style="background: #e83f2f"></li>
      <li id="cffc223" style="background: #ffc223"></li>
      <li id="cffdb59" style="background: #ffdb59"></li>
      <li id="c788b6f" style="background: #788b6f"></li>
      <li id="c486a5e" style="background: #486a5e"></li>
    </ul>
    
    <ul class="colors warm">
      <li id="c62164e" style="background: #62164e"></li>
      <li id="c86286e" style="background: #86286e"></li>
      <li id="cda79c2" style="background: #da79c2"></li>
      <li id="cf39079" style="background: #f39079"></li>
      <li id="ce83f2f" style="background: #e83f2f"></li>
      <li id="cffc223" style="background: #ffc223"></li>
      <li id="cffdb59" style="background: #ffdb59"></li>
      <li id="cf2c478" style="background: #f2c478"></li>
      <li id="c289539" style="background: #289539"></li>
      <li id="c174876" style="background: #174876"></li>
    </ul>
</div>

CSS

.demo .colors {
  overflow: hidden;
  margin: 20px 0;
  padding-left: 55px;
}

.demo .colors li {
  display: block;
  width: 96px;
  height: 96px;
  margin: 10px;
  float: left;
  border: 16px solid;
}

.demo .warm {
  display: none;
}

JavaScript

$(function() {
    var addCounter = 0,
        timer = null;

    function showElements(limit) {
        var $theFirstElements = $('.warm li:lt(' + limit + ')');

        $('.all').quicksand($theFirstElements, {
            duration: 1000,
            attribute: 'id',
            easing: 'swing'
        });
    }

    function addOne() {
        addCounter++;

        showElements(addCounter);
    }

    function startInterval() {
        timer = setInterval(addOne, 750);
    }
    
    // Auto-start
    startInterval();
});