当鼠标悬停在第一个链接以外的下拉链接上时,jQuery 下拉菜单会向上滚动
我有一个基于 Stu Nicholls CSS 多级下拉菜单的 jQuery 菜单。
我一直在努力添加动画下滑效果,但遇到了一个奇怪的问题。
当您将鼠标悬停在顶级列表项上时,嵌套的 ul 会向下滑动。当您将鼠标悬停在第一个锚链接上时,导航保持打开状态,但是当您将鼠标悬停在下面的任何锚链接上时,ul 就会开始向外滑动并反复上下滑动。
如果您将鼠标悬停在顶级列表项上,然后将鼠标直接向下拉到下拉列表上,然后快速将其关闭,似乎会发生类似的问题。
有关此问题的任何帮助 那就太好了!
I have jQuery menu I've been working on based on Stu Nicholls CSS multi-level drop down menu.
I've been working on adding an animated slide down effect yet I've run into an odd problem.
When you mouse over the top level list items, the nested ul slides down. When you mouse over the first anchor link the nav stays open, yet when you mouse over any anchor links below, the ul starts to spaz out and slides up and down repeatedly.
A similar issue seems to happen if you mouse over the top level list item, and pull your mouse straight down over the drop down and then off it it quickly.
Here is the test page I'm working on
Any help on this issue
would be great!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的问题似乎在这里,
因为你绑定到选择器
$('#nav ul li')
,并且每个导航项都是一个单独的 LI,当你从一个 LI 移动到下一个 LI 时,发生鼠标移出和鼠标悬停。我猜测发生这种情况是因为元素在这段时间“移动”,导致重复发生鼠标悬停/移出事件。您可能想尝试绑定到不同的元素,例如 UL。
your problem seems to be here
Since you are binding to the selector
$('#nav ul li')
, and each navigation item is a separate LI, when you travel from one LI to the next, a mouseout and mouseover occurs. I'm guessing the spazzing happens because the elements "move" during this time, causing repeated mouse over/out events to occur.You may want to try binding to a different element, such as the UL.