masonry
masonry copied to clipboard
Default filter (not an issue just a question :) )
Hi Desandro,
Bet your getting sick of me now. Just wondered what the best way is to set up a default filter - instead of initially seeing all 'bricks' could it show "red" only when page is first loaded and hide "blue" and "green".
Hope that makes sense.
Kind regards,
Ben
Filtering is going to be unsupported in Masonry once Isotope is released next week. Here's how you would set up a default filter with Isotope:
$('#container').isotope({
filter: '.red'
});
And on subsequent filters, the syntax is the same.
$('#container').isotope({
filter: '.blue'
});
I am sorry but I can get the answer and I have the same question. Where do I have to place the above code in this:
$('#filtering-nav a').click(function(){
var colorClass = '.' + $(this).attr('class');
if(colorClass=='.all') {
// show all hidden boxes
$wall.children('.invis')
.toggleClass('invis').fadeIn(speed);
} else {
// hide visible boxes
$wall.children().not(colorClass).not('.invis')
.toggleClass('invis').fadeOut(speed);
// show hidden boxes
$wall.children(colorClass+'.invis')
.toggleClass('invis').fadeIn(speed);
}
$wall.masonry();
return false;
});
in order to change the default filter. Thanks