Jquery,在淡入/淡出期间禁用/忽略悬停事件?
我想弄清楚这是否可能。我有一个图像地图,它会根据悬停在某些部分上而淡入/淡出。问题是,当用户在淡入淡出期间将鼠标悬停到不同区域时,它会完成它所做的淡入淡出然后是鼠标移动到的区域的淡入淡出。如果用户在几个不同的区域之间快速移动,那么淡入淡出显得非常跳跃和尴尬,所以我希望能够禁用悬停事件(淡入淡出)在另一个淡入淡出发生期间,所以它只是忽略它。
我考虑过使用某种延迟,但我不知道这是否可行,因为我认为它也会延迟淡入淡出。任何建议表示赞赏。
I'm trying to figure out if this is possible.. I have an image map that does fade in / fade out based on hovers over certain parts.. the problem is that when the user hovers to a different area during the fade it finishes the fade it was doing then does the one for the area the mouse was moved to.. if the user moves quickly between a few different areas then the fades appear really jumpy and awkward, so I want to be able to disable the hover event (the fade) during the time that another fade is going on so it just ignores it..
I have thought about using some sort of delay but I don't know if this can work since I would think it would delay the fade too.. any advice is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在看不到代码的情况下,您的工具是
:animated
和 jQuerys.stop()
方法的混合体。这可能看起来像
您还可以在链中的任何
.fadeIn()
之前调用.stop(true, true)
。这将停止当前动画并跳转到fx 队列
的末尾。参考文献::动画选择器、.stop(), .is()
Without seeing your code, your tools are a mix of
:animated
and jQuerys.stop()
method.That could look like
You might also call
.stop(true, true)
before any.fadeIn()
in your chain. That will stop the current animation and jump to the end of thefx queue
.References: :animated selector, .stop(), .is()
我认为您指的是 队列构建那里有问题。尝试在动画方法之前使用
stop
方法,例如:更多信息:
http://www.learningjquery.com/2009/ 01/quick-tip-prevent-animation-queue-buildup
至于平滑的动画,你可以选择 jQuery 缓动插件。
I think you are referring to queue buildup problem there. Try using the
stop
method before the animation method eg:More Info:
http://www.learningjquery.com/2009/01/quick-tip-prevent-animation-queue-buildup
As for smooth animation, you can go for jQuery Easing Plugin.