I have an isotope combination filter setup with a number of data-filter-group's, each with a rest/show all list item:
<li><a href="#" data-filter="*">Show all</a></li>
Is a way to reset all the data-filter-group's - a 'reset-all' link?
My current javascript is:
var $container = $('.content ul.sort'),
filters = {};
$container.isotope({
itemSelector : '.dynamic-filter'
});
// filter buttons
$('.filter a').click(function(){
var $this = $(this);
// don't proceed if already selected
if ( $this.hasClass('selected') ) {
return;
}
var $optionSet = $this.parents('.option-set');
// change selected class
$optionSet.find('.selected').removeClass('selected');
$this.addClass('selected');
// store filter value in object
// i.e. filters.color = 'red'
var group = $optionSet.attr('data-filter-group');
filters[ group ] = $this.attr('data-filter-value');
// convert object into array
var isoFilters = [];
for ( var prop in filters ) {
isoFilters.push( filters[ prop ] )
}
var selector = isoFilters.join('');
$container.isotope({ filter: selector });
return false;
});
Any idea's?
<-- Edit -->
Appear to have found an answer to my own question:
$(".isotope-reset").click(function(){
$(".content ul.sort").isotope({
filter: '*'
});
});