我需要让p:menubar
隐藏在mouseout
上。我怎么能得到这个?尝试覆盖PrimeFaces.widget.Menubar.prototype
方法,但所有时候都会被打破。
下一个解决方案适合我。我启动计时器以隐藏所有取消激活,在激活时重新激活并重新激活。
PrimeFaces.widget.Menubar.prototype.deactivate = function(b, a) {
var menu = this;
menu.activeitem = null;
b.children("a.ui-menuitem-link").removeClass(
"ui-state-hover ui-state-active");
b.removeClass("ui-menuitem-active ui-menuitem-highlight");
if (a) {
b.children("ul.ui-menu-child").fadeOut("fast");
} else {
b.children("ul.ui-menu-child").hide();
if (!this.timer) {
this.timer = setTimeout(function() {
menu.reset();
}, 300);
}
}
}
PrimeFaces.widget.Menubar.prototype.reactivate = function(d) {
if (this.timer) {
clearTimeout(this.timer);
this.timer = null;
}
this.activeitem = d;
var c = d.children("ul.ui-menu-child"), b = c
.children("li.ui-menuitem-active:first"), a = this;
if (b.length == 1) {
a.deactivate(b)
}
}
PrimeFaces.widget.Menubar.prototype.activate = function(b) {
if (this.timer) {
clearTimeout(this.timer);
this.timer = null;
}
this.highlight(b);
var a = b.children("ul.ui-menu-child");
if (a.length == 1) {
this.showSubmenu(b, a)
}
}