Answer the question
In order to leave comments, you need to log in
How to restart masonry?
Hello.
I have a page with Masonry connected, and also a menu with a filter for blocks that fade out (fadeOut). When I click on the filter, the blocks disappear, but masonry doesn't position them properly, i.e. there are empty spaces in place of blocks.
I understand that you need to restart masonry after applying each filter. Or maybe there is an option to make masonry position them immediately after applying the filter without restarting.
// скрипт позиционирования блоков
$('#masonry-container').masonry({
itemSelector: '.country-block',
singleMode: false,
isResizable: true,
isAnimated: true,
animationOptions: {
queue: false,
duration: 100
}
});
// скрипт фильтра стран
$(function() {
var newSelection = "";
$(".nav-menu").click(function(){
$(".nav-menu").removeClass("selected");
$(this).addClass("selected");
newSelection = $(this).attr("rel");
$(".country-block").not("."+newSelection).fadeOut(800);
$("."+newSelection).fadeIn(800);
$(".all-flavors").fadeTo(600, 1);
});
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question