Gab
Gab

Reputation: 2276

Exception to isotope filter items?

I use the following code to filter the content in my grid via my filter menu at http://themes.visualise.ca/visualise/

$('.menu-categories-navigation-container a').click(function(){
    var category = $(this).parent().attr('class');
    var filters = ('.'+category);
    $container.isotope({
        filter: filters,
    });
    return false;
});

But I would like the item with the .thelogo class to always remain visible since the logo and menu are part of my grid. So I thought I could maybe use some syntax in order to add some kind of exception? Maybe there is a better way?

Many thanks for your time and help.

Upvotes: 0

Views: 1074

Answers (2)

Sinetheta
Sinetheta

Reputation: 9429

The filter property in isotope is a selector string, feel free to add compound selectors (just add .thelogo to it).

$('.menu-categories-navigation-container a').click(function(){
    $container.isotope({
        filter: '.thelogo, .' + $(this).parent().attr('class')
    });
    return false;
});

ps: this will fail if any item has more than one class. As the selector would think it was looking for a tag with the name of the second class, inside the first.

edit: forgot period

Upvotes: 1

Gab
Gab

Reputation: 2276

The solution...

$('.menu-categories-navigation-container a').click(function(){
        var category = $(this).parent().attr('class');
        var filters = ('.'+category);
        $container.isotope({
            filter: '.thelogo, ' + filters,
        });
        return false;
});

Upvotes: 0

Related Questions