Quick jQuery selector question

Soldato
Joined
20 Nov 2002
Posts
11,141
Location
Barnsley
Hi guys,

I've got a little jQuery filter using Isotope http://isotope.metafizzy.co/ which updates depending on a jQuery selector as it's filter.

Basically what I have is multiple option sets all with a few options within each and I'm struggling to get it to filter how I want it.

Is it possible in jQuery to do something like the following in a selector:

Optionset
Option 1 OR
Option 2 OR
Option 3

AND

Optionset
Option 1 OR
Option 2

AND

Optionset
Option 1 OR
Option 2

...and so on and so forth. I'm not sure I'm explaining myself too well :p

This combo filter method is kind of what I want, but only 1 item is allowed to be selected per optionset http://isotope.metafizzy.co/demos/combination-filters.html

Let me know if you need further explanation and thanks in advance for any help :)
 
Soldato
OP
Joined
20 Nov 2002
Posts
11,141
Location
Barnsley
I know, I said it was kind of doing what I wanted - but yeah I'm probably not clear enough sorry.

I'd like to be able to select any number of options from each optionset, but the logic applied for the filter should be as per my example.

Does that make more sense?
 
Soldato
OP
Joined
20 Nov 2002
Posts
11,141
Location
Barnsley
A little update to this, I've made an example so far using the combo filter thing here: http://codepen.io/anon/pen/zbiad

Basically what I want is to be able to click ANY number of options per optionset. So for instance if I click Black, Circle, then Small AND Medium clicked - the filter would display all black circles that are small OR medium. Also if something is selected, it can be unselected by clicking it again.

Cheers again for any help or pointers. I've a feeling I might be making a glaring error in my JavaScript on this bank holiday :p
 
Last edited:
Soldato
OP
Joined
20 Nov 2002
Posts
11,141
Location
Barnsley
I think I need some kind of function to iterate through all possible options updating the selector variable to something like:

.black.square, .blue.square

That would be if black and blue were selected in the first optionset and just square in the second optionset.

My JS is a limited so any pointers appreciated.
 
Back
Top Bottom