2011-05-13 63 views
1

我在div上使用mouseenter/mouseleave使其淡入淡出。mouseenter/mouseleave和褪色的問題

問題是,當它快速懸停的結果div某些種類的隊列div保持多次褪色。

好像我需要停止像「在mousenter然後停止淡出」的效果。

任何想法?

+1

使用['停止()'](http://api.jquery.com/stop/)的部分'淡入()'/'淡出()'。 – 2011-05-13 17:12:30

+0

stop()
用於除淡入或淡出之外的任何東西,您需要編寫它
stop(true,true)
..我很確定.. – locrizak 2011-05-13 17:15:21

+0

感謝您的幫助! :) – Fuxi 2011-05-13 17:35:01

回答

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(); 
});