masonry
masonry copied to clipboard
Re-initiliaze the masonry
Hello. I am using latest version of masonry. I have issues on my search results page as I am opening and closing sidebar which pushes the images to smaller size. It works nicely only problem is that masonry leaves spaces between images. If I launch Firefox inspect tool it looks OK probably because inspect tool re-initializes the masonry. I tried to achieve this following some solutions on the web, but with no luck. The perfect solution would be to arrange masonry when opening and closing sidebar. This my code for masonry:
$(window).load(function(){
// Rooms Masonry
var container = $('.rooms.rooms-masonry > .rooms-inside');
container.masonry({
itemSelector: '.room',
columnWidth: 1,
});
showSearchFields(window.SEARCH_TYPE);
});
After the container size has changed, you should trigger .masonry() to re-layout the items.