kombai / freewall

Freewall is a cross-browser and responsive jQuery plugin to help you create grid, image and masonry layouts for desktop, mobile, and tablet...
MIT License
1.85k stars 375 forks source link

Freewall will fire until window is resized #203

Closed lr150561 closed 8 years ago

lr150561 commented 8 years ago

Hello,

I am loving Freewall but am having a hard time getting it to fire on page load. I am getting the images using instafeed.js. No matter how far down I put the script or even if I tell it to execute after all images are loaded it will not until I resize the browser. Any help would be hugely appreciated..

Thanks!

daniftinca commented 8 years ago

i have this problem too. On my page I have two freewall galleries. The first one loads without a problem but the second one loads with images of random width and height, but returns to normal on resize or even if i click on inspect element. (i tested in mozilla)

Edit. I tested in chrome too and on that the images are in another order.

m3xx commented 8 years ago

i have this problem too.

tiersept commented 8 years ago

I'm guessing all of you are using the Pinterest grid?

tiersept commented 8 years ago

try this under your freewall script

$(window).trigger('resize');

PhantomRay commented 8 years ago

Hi @lr150561

I believe you didn't do it write. I trigger wall.refresh() after all images being loaded (exclude those image loading errors).

sample code like this

var images = $(html).find('img');
var length = images.length;
images.load(checkImageStatus);
images.error(checkImageStatus);

wall.appendBlock(html);

function checkImageStatus() {
    --length;
    if (!length) {
        setTimeout(function () {
            wall.refresh();
        }, 505);
    }
}
kombai commented 8 years ago

Thank you @dragonfish-au 👍

https://github.com/kombai/freewall/issues/203 https://github.com/kombai/freewall/issues/207 https://github.com/kombai/freewall/issues/208 https://github.com/kombai/freewall/issues/215