Skip to content

Instantly share code, notes, and snippets.

@pawelztef
Last active March 20, 2018 09:44
Show Gist options
  • Select an option

  • Save pawelztef/642748b26979af5efac62c336914a25c to your computer and use it in GitHub Desktop.

Select an option

Save pawelztef/642748b26979af5efac62c336914a25c to your computer and use it in GitHub Desktop.
Masonry - How do I avoid showing "jumping" bricks on page load
$(window).load(function(){
var grid = $('#masonry-container').masonry({
itemSelector: '.box',
columnWidth: 300,
gutterWidth: 10,
isFitWidth: true
});
function onLayout() {
$('#masonry-container').css('visibility', 'visible');
}
grid.on('layoutComplete', onLayout());
});
#masonry-container {
visibility: hidden;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment