我正在创建一个jQuery菜单栏,并且所有内容都看起来不错,但是当我将鼠标放在顶级菜单项上有一个子菜单,其中第一个菜单项也有一个子菜单时,会产生奇怪的效果。如果我将鼠标移入和移出(在View菜单项左右移动)20次,我将开始看到View> Encoding子菜单向右移动的次数越来越多。jQuery用户界面Menubar幻影子菜单问题
我可以用修改后的菜单栏演示示例重新创建问题。我在Firefox 20.0.1上。
在这里看到:http://jsfiddle.net/Njjgm/
我想,这是找到subsub菜单的右侧边缘,然后设置相同subsub菜单到该位置的新的左边缘......所以,如果我放慢了开盘或修复定位数学,然后我不应该有这个错误。
我正在寻找jquery.ui.menubar.js文件,看看我是否可以调整setTimeouts,或修复subub菜单定位但没有任何运气。
我在看这个(从jquery.ui.menubar.js线262):
__applyMouseBehaviorForSubmenuHavingMenuItem: function (input, menubar) {
var menu = input.next(menubar.options.menuElement),
mouseBehaviorCallback = function(event) {
// ignore triggered focus event
if (event.type === "focus" && !event.originalEvent) {
return;
}
if (event.type === "mouseenter") {
this.element.find(":focus").focusout();
if (this.stashedOpenMenu) {
this._open(event, menu);
}
this.stashedOpenMenu = undefined;
}
if ((this.open && event.type === "mouseenter")
|| this.options.autoExpand) {
if (this.options.autoExpand) {
clearTimeout(this.closeTimer);
}
this._open(event, menu);
}
};
而且也是在这个:(从jquery.ui.menubar.js 68行)
focusin: function(event) {
clearTimeout(menubar.closeTimer);
},
focusout: function(event) {
menubar.closeTimer = setTimeout (function() {
menubar._close(event);
}, 150);
},
"mouseleave .ui-menubar-item": function(event) {
if (menubar.options.autoExpand) {
menubar.closeTimer = setTimeout(function() {
menubar._close(event);
}, 150);
}
},
"mouseenter .ui-menubar-item": function(event) {
clearTimeout(menubar.closeTimer);
}
已经看到和之前修复此人与jQuery用户界面菜单栏的经验?有谁知道setTimeout的修复? HoverIntent似乎使用与菜单栏相同的set/clearTimeout技术,所以我不想从菜单栏中删除所有逻辑以添加它。欢迎任何建议。谢谢。