mouseenter / mouseleave和褪色问题

时间:2011-05-13 17:10:23

标签: jquery fading

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

问题是当快速将div旋转时,会导致某些队列中的div不断衰落几次。

似乎我需要停止效果,例如“在鼠标上然后停止淡出”。

有什么想法吗?

1 个答案:

答案 0 :(得分: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();
});