I've got something I've put together using jQuery isotope here.. http://jsbin.com/eziqeq/6/edit
It seems to work in general but on first load, of a new tab, the Isotope plugin is setting the height of the wrapper element to 0. If I refresh the page it does work and sets the height of the parent element based on the the items found inside.
Any help would be greatly appreciated. I can't think why off this first load this isn't working and on subsequent reloads it is.. unless its perhaps something to do with caching the images it loads?
EDIT--
This is a caching issue in Webkit browsers as it works on Firefox and on a working tab when I clear the cache and refresh the page it won't work until refreshed again.
There is another option to solve this issue. You have to use another one js if your
grid-item
contain anyimage
. below the js link isThen call this placeholder js below:
You can get full and clear details from isotop's official website. link
Quick pure JavaScript example to check if all imagery has loaded before initialising the isotope library.
$('window').imagesLoaded( function() {
You need to use the imagesLoaded plugin in chrome. Wait until all images are loaded before initializing isotope
A much better way to fix this is to provide width and height to the isotope item and/or the images itself. With the widnow load method you'll end up waiting a few seconds before isotope kicks in and the layout will change which is weird.
Here's what i use in a WordPress theme inside a post loop:
You could use a plugin as suggested by
mkoryak
.or you could use the following: (no plugin required - jQuery only):
Using the above method, you can also be sure that all the
CSS
stylesheets are loaded as well (to make sure your page is displayed properly whenisotope
kicks in)."DOM ready" fires when the DOM is ready (ie the markup).
"Window load" waits for all the resources and then fires.