jquery 菜单在悬停时会动画显示,但在元素之间移动时会折叠...帮助

发布于 2024-10-06 14:50:13 字数 737 浏览 0 评论 0原文

jquery 菜单被编程为在鼠标悬停时动画显示并在鼠标移开时折叠。然而,当用户将鼠标悬停在项目上时,这是一个问题,因为当用户到达其中一个框的边缘时,它不再将其视为将鼠标悬停在整个菜单上。任何图像上都没有填充/边距或边框。它是一个 2 x 3 的正方形网格,所以所有的都很好地组合在一起。这是与每个列表元素相关的 jquery 代码。

$("li.menu3").mouseover(function(){

$("ul.inactive3").stop().animate({宽度: "500px", 高度: "150px"}, "fast", function( ){ $("ul.inactive3").stop().animate({width: "500px", height: "300px"}, "fast");

});

});

$("li.menu3").mouseout(function(){

$("ul.inactive3").stop().animate({宽度: "500px", 高度: "150px"}, "fast", function( ){ $("ul.inactive3").stop().animate({width: "0px", height: "0px"}, "fast");

});

我尝试通过简单地使用一个图像并在顶部放置多个图像映射来克服这个问题,但这带来了鼠标悬停在 Chrome 中不起作用的新问题。

任何帮助将不胜感激。

谢谢,迈克

The jquery menu is programmed to animate out on mouseover and collapse on mouseout. However this is a problem while the user is hovering over the items as when the user reaches the edge of one of the boxes it no longer counts it as having the mouse over the whole menu. There is no padding / margin or border on any of the images. It is a 2 x 3 grid of squares so all fits together nicely. Here is the jquery code which relates to each list element.

$("li.menu3").mouseover(function(){

$("ul.inactive3").stop().animate({width: "500px", height: "150px"}, "fast", function(){
$("ul.inactive3").stop().animate({width: "500px", height: "300px"}, "fast");

});

});

$("li.menu3").mouseout(function(){

$("ul.inactive3").stop().animate({width: "500px", height: "150px"}, "fast", function(){
$("ul.inactive3").stop().animate({width: "0px", height: "0px"}, "fast");

});

I tried overcoming this by simply using one image and placing several image maps over the top, however this presented new problems of the mouseover not working in chrome.

Any help would be greatly appreciated.,

Thanks, Mike

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

暮光沉寂 2024-10-13 14:50:14

我使用一个名为hoverintent 的jquery 插件找到了答案。

链接在这里,以防其他人遇到同样的问题

http://cherne.net/brian /resources/jquery.hoverIntent.html

I figured out the answer, using a jquery plugin called hoverintent.

the link is here incase anyone else comes across the same issue

http://cherne.net/brian/resources/jquery.hoverIntent.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文