JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://isotope.metafizzy.co/jquery.isotope.min.js"></script>
<a href="#" id="good">Shuffle</a> |
<a href="#" id="bad">Original order (broken)</a>
<div id="container">
<div class="item w1 h1">1</div>
<div class="item w2 h1">2</div>
<div class="item w1 h2">3</div>
<div class="item w1 h1">4</div>
<div class="item w2 h2">5</div>
<div class="item w2 h1">6</div>
<div class="item w1 h1">7</div>
<div class="item w1 h1">8</div>
<div class="item w1 h2">9</div>
<div class="item w2 h2">10</div>
<div class="item w2 h1">11</div>
</div>
CSS
#container {
margin: 0 auto;
border: 2px solid black;
height: 430px;
margin: 20px 0 0 0;
}
.item {
float: right;
background: #CCC;
width: 100px;
height: 100px;
margin: 10px;
}
.item.w1 {
width: 100px;
}
.item.w2 {
width: 200px;
}
.item.h1 {
height: 100px;
}
.item.h2 {
height: 200px
}
.isotope,
.isotope .isotope-item {
/* change duration value to whatever you like */
-webkit-transition-duration: 0.8s;
-moz-transition-duration: 0.8s;
transition-duration: 0.8s;
}
.isotope {
-webkit-transition-property: height, width;
-moz-transition-property: height, width;
transition-property: height, width;
}
.isotope .isotope-item {
-webkit-transition-property: -webkit-transform, opacity;
-moz-transition-property: -moz-transform, opacity;
transition-property: transform, opacity;
}
JavaScript
$(function(){
$("#good").click(function() {
$("#container").isotope('shuffle');
return false;
});
$("#bad").click(function() {
$("#container").isotope({'sortBy':'original-order'});
return false;
});
$("#container").isotope({
layoutMode: 'masonryHorizontal',
masonryHorizontal: {
rowHeight: 60
}
});
});