打开另一个时,如何关闭Filtrify面板? [英] How do I close the Filtrify panel when opening another?
问题描述
我目前正在使用Isotope整合的网站的美丽Filtrify脚本(http://luis-almeida.github.com/filtrify/)。
I'm currently using the beautiful Filtrify script of a website of mine with Isotope integration (http://luis-almeida.github.com/filtrify/).
在我的网站上,我有4类别/面板搜索我的领域。当我打开第一个类别/面板,将鼠标悬停到下一个,并打开它,第一个仍然打开。使用CSS或Javascript,可以关闭一个打开的Filtrify面板,当悬停到下一个类别/按钮以打开另一个Filtrify面板?现在,如果我打开它们,只是保持开放。例如,在此处打开类型,主要演员和导演: http: //luis-almeida.github.com/filtrify/movies.html
On my site I have 4 "categories"/panels for searching my -field. When I open the first category/panel and hover the mouse over to the next one, and open it, the first one is still open. Is it possible, with CSS or Javascript, to close a opened Filtrify panel when hovering over to the next category/button to open another Filtrify panel? Now the just remains open if I open them all. For an example, open "genre", "main actors" and "director" here: http://luis-almeida.github.com/filtrify/movies.html
真的会感谢您的帮助!
Would really appreciate your help! Thank you in advice!
推荐答案
我不知道库的深度,但你可以尝试关闭面板的兄弟姐妹
I do not know in depth the library, but you could try to close the siblings of a panel before opening another panel.
此方法的第一个近似值可能是:
a first approximation of the method could be:
Filtrify.prototype.closeSiblingsPanel = function ( f ) {
for(var item in this._menu){
if(item !== f && this._menu[item].panel){
this._menu[item].panel.addClass("ft-hidden");
this._menu[item].label.removeClass("ft-opened");
}
}
};
您还必须修改点击事件处理程序:
you also have to modify the click event handler:
Filtrify.prototype.events = function ( f ) {
//...
this._menu[f].label.on("click", this._bind(function(event){
this.openPanel( f );
this.closeSiblingsPanel( f );
this.bringToFront( f );
event.stopPropagation();
}, this) );
//...
};
这篇关于打开另一个时,如何关闭Filtrify面板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!