In order to respond to Lewis' comment and give an answer to people looking for a solution in v3, the hidden v3 method no longer exists, you just need to use the jQuery hide () method after starting the masonry layout. So the idea is to hide the elements:
$('.something-to-hide').each(function(){ $(this).hide(); }); $('.grid').masonry('layout');
Then, to display hidden items:
$('.class-for-all-elements').show() $('.grid').masonry('layout');
In my case, I add to do a search before hide, so I used the each () function.
Stéphane
St3ph
source share