luis-almeida / filtrify

Beautiful advanced tag filtering with HTML5 and jQuery
Other
644 stars 113 forks source link

Isotope Reset All Filters #19

Open gabrielhuerta opened 11 years ago

gabrielhuerta commented 11 years ago

I did not find any documentation about implementing a reset trigger in Isotope so I thought I would share how I got it to work.

Initially I could not get ft.reset(); to work until I finally added var ft = back in. It is absent from the javascript shown in the original Isotope example

 
   var ft =  $.filtrify("container", "placeHolder", {
        hide     : false,
        callback : function ( query, match, mismatch ) {
            container.isotope({ filter : $(match) });
        if ( mismatch.length ) $("div#reset").show();
            else $("div#reset").hide();
        }
    });

    $("div#reset > span").click(function() {
        ft.reset();
    });

Thanks for the plugin Luis!

povilas123 commented 11 years ago

Hello i make like this, and it's works

$(function() {

var container = $("#container");

container.isotope({
    itemSelector : 'ul#container > li',
    layoutMode : 'fitRows'
});

var ft = $.filtrify("container", "placeHolder", {
close : true,
    hide     : false,
    callback : function ( query, match, mismatch ) {
        container.isotope({ filter : $(match) });
                    if ( mismatch.length ) $("div#reset").show();
        else $("div#reset").hide();
    }
});
    $("div#reset span").click(function() {
    ft.reset();
});

});