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

Images Layout - keeping the same layout and image sizes #154

Closed tsdevteam closed 8 years ago

tsdevteam commented 9 years ago

Hi,

We are using the images layout and think it's great except when we refresh the page e.g. (http://vnjs.net/www/project/freewall/example/image-layout.html) it changes the layout and image sizes. Is there anyway we can keep the exact same layout every time it refreshes? We need it to be fixed to the same position all the time.

Thanks

tsdevteam commented 9 years ago

Hi all, just following up on this if anyone can please help with this question that would be much appreciated. Unfortunately we are on a tight deadline to implement our solution.

Many thanks in advance

alexelash commented 9 years ago

Hi. Not sure if this is still relevant to you guys, but I think that this is related to my recent question here: https://github.com/kombai/freewall/issues/184 . It's not how Freewall is really made to work, but the plugin author gave a very helpful solution.

I ended up telling freewall to do the following:

wall.reset({
      selector: '.brick',
      animate: true,
})
wall.fitWidth(initialWindowWidth);

Then, outside of Freewall's resize function, I added this code:

$(window).on("resize", function() {
      var magicNum = $(window).width()/initialWindowWidth;
      $('#freewall-container').css('-webkit-transform', 'scale('+magicNum+')');
});

Just make sure that you apply

-webkit-transform-origin: top left;
to your CSS. Hope that this helps!

kombai commented 8 years ago

Thank you @alexelash 👍