1

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

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

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

有任何想法吗?

4

1 回答 1

3

您可以使用 .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();
});
于 2011-05-13T17:18:38.780 回答