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

Make fixed-pos block update when grid width too small to display it #146

Open migplay opened 9 years ago

migplay commented 9 years ago

The problem is that I have a fixed-position block of size2x2 at the 4th column from left. When I resize the grid smaller and when only 4 column displayed my fixed block get cut to size1x2. I would like to have a parameter on wall.refresh that give me the number of columns so I could update my fixed-position block and make an action on it (hide, reduce to 1x1, move, ...).

kombai commented 9 years ago

You can get the total number of columns via onComplete event:

 wall.reset({

 onComplete: function(block, setting) {
   console.log(setting, setting.runtime, setting.runtime. totalCol);
 }
})
migplay commented 9 years ago

Thank you kombai, but it is not working well, sometimes the nb of columns is right, but sometimes it is blocked to a certain number, see my screengrab, totalcol is always 5 instead of 3 here. Codepen : http://codepen.io/migswd/pen/ZYRbVE

* UPDATE * Sorry in fact it was a conflict with CODEPEN window. Because I tested your code in my website and it works great basically. Just a little fix needed : HOLES in the grid make a delay in the calculation of the right number of columns, should be easy to fix I hope :) !