The idea is simple, I'm using checkboxes to filter a list but I can't work out how to filter the results.
For example, checkbox for horror movies returns all the movies with a class of "horror", but I can't work out how to then continue to filter for a given day "today, weekdays or weekends" with only the results from the visible horror results. When clicking on a day type I'm returned ALL results that have that day type class.
Have a look at this fiddle
Here is the magic that needs a little help.
$('.tags').find('input:checkbox').on('click', function() {
$('.results > div').hide();
$('.tags').find('input:checked').each(function() {
$('.results > div.' + $(this).attr('rel')).addClass('active').show();
});
$('input.dayCheck').on('change', function() {
$('input.dayCheck').not(this).prop('checked', false);
});
});
Aucun commentaire:
Enregistrer un commentaire