[英]jQuery - hover IE issue
I have a custom menu in jQuery that apparently doesn't work with IE 8 & 9. It's supposed to open multilevel menus with the hover()
method, but it's only working o IE untill the first level from the root. 我在jQuery中有一个自定义菜单,该菜单显然不适用于IE 8和9。应该使用
hover()
方法打开多级菜单,但是它只能在IE上运行,直到从根目录到第一级为止。
Code : 代码:
$('ul#leftmenu li').hover(function() {
if ($(this).hasClass('top'))
return false;
var p = $(this).parent().get(0);
var o = $(this).offset();
var t;
var l;
if (leftmenu_level >= 1)
{
t = 0;
l = 210;
}
else
{
leftmenu.top = o.top;
leftmenu.left = o.left;
t = o.top;
l = o.left + 210;
}
$(this).find('ul:first').css({
position : 'absolute',
top : t,
left : l
}).show();
$(this).find('a:first').css('color', '#5a3512');
leftmenu_level++;
return true;
}, function() {
if ($(this).hasClass('top'))
return false;
$(this).find('a:first').css('color', '#777777');
leftmenu_level--;
$(this).find('ul:first').hide();
return true;
}
);
Live example (left menu) : 现场示例(左侧菜单):
http://lrp-workwear.com/ http://lrp-workwear.com/
Any tips? 有小费吗?
Try applying position:relative
to your anchor tags, this seems to force the width & height of the anchor tags correctly and triggers a hover over the entire element and not just the text as it currently seems to be doing. 尝试对您的锚标签应用
position:relative
,这似乎可以正确地强制锚标签的宽度和高度,并触发将鼠标悬停在整个元素上,而不仅是当前看起来正在执行的操作。
Hope this helps 希望这可以帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.