I am working on a masonry layout for an image gallery. But masonry most of the time displays images overlapped on one another. Rest of the time its ok and sometimes some ima
First use imagesLoaded
:
// with jQuery
var $container = $('#container');
// initialize Masonry after all images have loaded
$container.imagesLoaded( function() {
$container.masonry();
});
then, if you can, specify the image width/height attributes on image tag
<img src="...." width="200" height="200" />
imagesLoaded is not deprecated:
http://masonry.desandro.com/layout.html#imagesloaded