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

Out of memory error when fitWidth() not called before appendBlock #80

Closed jlawrence-yellostudio closed 10 years ago

jlawrence-yellostudio commented 10 years ago

var wall = new freewall('#free-wall'); wall.reset({ selector: '.brick', animate: true, cellW: 150, cellH: 150, delay: 50, onResize: function() { wall.fitWidth(); } }); wall.appendBlock('<div class="brick">test</div>');

Above code with an empty HTML layout with no CSS applied to container causes infinite loop and instant crash, resulting in Out of memory errors in both Firefox and Chrome.

Simply adding a call to: wall.fitWidth() prior to calling wall.appendBlock(data) appears to resolve the problem.

That being said: it would make more sense to add a call to fitWidth in appendBlock if the wall has not be initialised.

kombai commented 10 years ago

Thanks for report.