I'm trying to use isotope to make images show in a masonry
style.
I've included the following in my header:
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery.isotope/2.2.0/isotope.pkgd.min.js"></script>
<script>
var $container = $('.album-lister');
$container.isotope({
itemSelector: '.thumb',
masonry: {
columnWidth: 100
}
})
</script>
My HTML looks like this:
<ul class="album-lister">
<li class="thumb"><img src="http://localhost/57898d673ae1f7482d04ab1c3de60363.jpg"></li>
<li class="thumb"><img src="http://localhost/behind_scenes_1.jpg"></li>
<li class="thumb"><img src="http://localhost/behind_scenes_2.jpg"></li>
<li class="thumb"><img src="http://localhostbehind_scenes_3.jpg"></li>
</ul>
I've added the following CSS:
.album-lister .thumb img{ max-width: 100%;height:auto;}
.album-lister .thumb{width:20%;}
What am I missing? Nothing is resized to 100px and there is no difference.
Edit: I have tried using imagesLoaded as suggested:
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery.isotope/2.2.0/isotope.pkgd.min.js"></script>
<script src="http://imagesloaded.desandro.com/imagesloaded.pkgd.min.js"></script>
var $container = $('.album-lister').imagesLoaded( function() {
$container.isotope({
itemSelector: '.thumb',
layoutMode: 'fitRows',
masonry: {
columnWidth: 100
}
});
});