I am trying to filter a list of restaurant's based on their influences. I would like to use sliders instead of generic categories like Indian/Asian/Mexican/European cuisine.
A restaurant could be
[{restaurant:
{name: 'The Apollon',
thumb: 'apollon.jpg',
type:
[{spicy: 5, type_id: 1}
{garlic:3, type_id:2}
{expensive:10, type_id:3}]}
}]
I'd then use a generic JQuery UI slider and pass the value from each slider to a hidden element.
Here is where I am utterly stuck though.
I can get it to work on one slider by utilizing classes instead of JSON( .nospice .somespice .spicy ) and doing an if (value >= 7) {$('.spicy').show();}
, but I'm not sure how I'd go about doing more advanced queries (if x = >=7 AND y = >=3 AND z = >=5)
Does someone want to nudge me in the right direction here? What do I need to read up on. If I am going about this in a fantasticly wrong way, please do tell.
jsfiddle: http://jsfiddle.net/techii/9e2cJ/
jQuery has a
.filter
method. I would also recommend that you store the restaurant object with the div using.data
to store the restaurant name and type with its div:In your case I would suggest using
$.each
however: