diff --git a/js/filtrify.js b/js/filtrify.js index 53ad352..d0c294d 100644 --- a/js/filtrify.js +++ b/js/filtrify.js @@ -16,7 +16,8 @@ block : [], close : false, query : undefined, // { category : [tags] } } - callback : undefined // function ( query, match, mismatch ) {} + callback : undefined, // function ( query, match, mismatch ) {} + exclusivePanel : true //When a panel is opened, close all others. }; function Filtrify( containerID, placeholderID, options ) { @@ -229,11 +230,24 @@ }; Filtrify.prototype.openPanel = function ( f ) { + if (this.options.exclusivePanel){ + this.closeAllOtherPanels(f) + } this._menu[f].label.toggleClass("ft-opened"); this._menu[f].panel.toggleClass("ft-hidden"); this._menu[f].search.find("input").focus(); + + }; + + Filtrify.prototype.closeAllOtherPanels = function ( f ){ + for (var i in this._order){ + var menu =this._order[i]; + if (menu != f) + this.closePanel(menu); + } }; + Filtrify.prototype.closePanel = function ( f ) { this.resetSearch( f ); this._menu[f].panel.addClass("ft-hidden");