Javascript 如何在鼠标上隐藏primefaces菜单栏

Javascript 如何在鼠标上隐藏primefaces菜单栏,javascript,primefaces,Javascript,Primefaces,我需要获取p:menubar来隐藏mouseout。我怎么能得到这个? 尝试重写PrimeFaces.widget.Menubar.prototype方法,但总是出现问题。下一个解决方案适合我。我启动定时器,在停用时隐藏所有,在激活和重新激活时清除它 PrimeFaces.widget.Menubar.prototype.deactivate = function(b, a) { var menu = this; menu.activeitem = null;

我需要获取
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)
       }
}

下一个解决方案适合我。我启动定时器,在停用时隐藏所有,在激活和重新激活时清除它

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)
       }
}

下一个解决方案适合我。我启动定时器,在停用时隐藏所有,在激活和重新激活时清除它

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)
       }
}

下一个解决方案适合我。我启动定时器,在停用时隐藏所有,在激活和重新激活时清除它

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)
       }
}