0
我有一些jquery同位素過濾器和排序。所有的作品都非常好,但我想創建一個重置按鈕。重置jQuery IsoTope過濾器和排序
我已經嘗試了以下(http://stackoverflow.com/questions/10297558/isotope-reset-all-combination-filters),但雖然它似乎重置項目(第二次單擊),它不會重置過濾器按鈕。
我有一些jquery同位素過濾器和排序。所有的作品都非常好,但我想創建一個重置按鈕。重置jQuery IsoTope過濾器和排序
我已經嘗試了以下(http://stackoverflow.com/questions/10297558/isotope-reset-all-combination-filters),但雖然它似乎重置項目(第二次單擊),它不會重置過濾器按鈕。
我只能假設你的意思寫
時「不重置過濾器按鈕的外觀」 [...]它不會重置過濾器按鈕。
如果是這種情況,並且過濾按鈕的外觀是由CSS類控制的,就像在Isotope的示例中一樣,您只需從過濾按鈕元素中刪除所有CSS類用戶點擊「重置」按鈕。
在e。的來源中。 G。 Isotope's 'Combination filters'-demonstration你會發現下面的代碼,處理一切,當過濾器,一個按鈕被點擊發生的事情:
$optionSet.find('.selected').removeClass('selected');
$this.addClass('selected');
:
// 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;
});
重要的代碼(希望)與你的問題可以在這些線路中找到