【问题标题】:Problem with mouseenter/mouseleave and fadingmouseenter/mouseleave 和褪色问题
【发布时间】:2011-05-13 17:10:23
【问题描述】:

我在 div 上使用 mouseenter/mouseleave 来淡入淡出。

问题是当快速将 div 悬停时,它会导致某种队列,其中 div 会不断消失几次。

似乎我需要停止“在鼠标上然后停止淡出”之类的效果。

有什么想法吗?

【问题讨论】:

  • stop() 用作fadeIn()/fadeOut() 的一部分。
  • 对于
    stop()
    与淡入或淡出以外的任何内容一起使用,您需要编写它
    stop(true,true)
    .. 我很确定。 .
  • 感谢您的帮助! :)

标签: jquery fading


【解决方案1】:

您可以使用 .stop(),此处记录:http://api.jquery.com/stop/

$('#hoverme-stop-2').hover(function() {
  $(this).find('img').stop(true, true).fadeOut();
}, function() {
  $(this).find('img').stop(true, true).fadeIn();
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-10-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-16
    • 1970-01-01
    • 2023-03-14
    • 1970-01-01
    相关资源
    最近更新 更多