Grow your CSS skills. Land your dream job.

[jquery] Filter by multiple selected tags/classes

  • # November 27, 2008 at 11:50 pm

    Hi all,

    I’m reasonably new to jquery, and wondering if there’s a way of filtering by multiple options.

    Say I have a list of thumbnails on a page, and they have various tags assigned to them as classes. (so one thumbnail might be class="yellow car february", another "blue train march".

    At the top of the page, I have a list of these various tags (not dynamically generated). If I click "yellow", it filters the thumbnails so that only the one’s with the class yellow stay and the rest fadeOut. If I then click "car" then it filters down to only thumbnails that have both the yellow and car classes. And then if I click "car" again, it returns to showing all the yellow ones. I hope that makes sense.

    Is that something that can be done with jquery?

    Any kind of help, or just pointing in the right direction would be much appreciated. Cheers!

    # January 8, 2012 at 2:15 pm

    Hey Nathan,

    I know it has been years, but I just posted a tutorial on how to do this at http://www.learnerdesign.com/news/2011/12/31/filter-results-by-multiple-tags-with-jquery/.

    I hope it helps!

    -Noah

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".