简单的 jquery 动画 - 鼠标移动过多的问题
我有一个用 jquery 构建的简单下拉菜单。代码在这里: http://jsfiddle.net/7Gpww/
一切看起来都很好,但是如果你移动鼠标有点疯狂,不要等待完整菜单加载后再移动到下一个菜单,它会挂起。例如,如果我快速将鼠标移过所有菜单项,让动画开始但不会结束,然后返回到“支持”,则下拉菜单将仅加载大约一半的项目,就像它被遗忘一样
实际应该有多长。我在一些地方不断遇到这个问题。有办法解决这个问题吗?
提前致谢
I have a simple drop menu I'm building in jquery. The code is here: http://jsfiddle.net/7Gpww/
it all seems fine, but if you move the mouse around a bit manically and don't wait for the full menu to load before you move to the next one, it'll hang. so for example, if I run the mouse across all the menu items quickly, letting the animation start but not get to the end, and then go back to SUPPORT for example, the dropdown menu will only load about half the items, like it's forgotten how long the <ul>
should actually be.
I keep running into this in a few places. is there a way around this?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经更新了你的小提琴: http://jsfiddle.net/7Gpww/1/
你几乎在那里,您只需在每个新动画之前添加对
.stop()
函数的调用即可清除先前排队的动画。I've updated your fiddle: http://jsfiddle.net/7Gpww/1/
You were almost there, you just needed to add calls to the
.stop()
function before each new animation to clear the previously queued animations.