It seems that when I try to load the page, all the images are stacked on top of one another. But if you were to click a link which takes you to the same page (like the home link) then masonry kicks in. So I think masonry is loading too early, like before jquery readies the page or something.
Here my jquery call:
$(document).ready(function(){
$('#image_roll_container').masonry({
itemSelector: '.box'
});
....
Here's the page in question:
it works just fine in firefox and IE8.
On Firefox and on my iPad 2 masonry was working fine but in chrome and safari on OS X the elements were overlapping/stacking on page load and until a window resize even happen. After digging in the code of jquery.masonry.js I found that I can trigger a resize() right after creating the masonry so that all elements rearrange properly. Now everything is working fine.
all of the other solutions: (window).load, setting width & height in CSS and on img attributes, etc, just didn't work for me.
I recently came across this issue. To fix it, I utilized the img width and height attributes. The issue resolved itself.
The "load" event will trigger for every image in the DOM, this is overkill. You need to update the layout of the masonry when the last image in the DOM loads. Here is the code:
Another way, if you know the image heights, is to assign them in the CSS before you load Masonry, then the layout is faster than waiting for the images. This method works if, for example, all your images are the same size. Then your site will still load quickly on slow connections, like mobile.
I posted a bit of script for alternative method here:
http://instancia.net/loading-jquery-masonry-on-mobile/
If you use this script, edit the numbers to match yours.
Tried everything suggested in this thread, nothing worked, then found this:
Works fine now, found it here: https://github.com/desandro/masonry/issues/35
Original post author: https://github.com/desandro