js and css fix for masonry layout