我試圖顯示和隱藏懸停元素上的元素。我的代碼工作,但是當用戶鼠標懸停及移出元素非常快,動畫就跑甚至鼠標移開它:(jquery停止動畫,如果另一個仍在運行
$('.EventNameList').hover(
function() {
$(this).stop().animate({ backgroundColor: '#eaeaea' }, 200, "easeInQuad");
$(this).find('div#TrainingActionButtons').show("fast");
},
function() {
$(this).stop().animate({ backgroundColor: '#ffffff' }, 800, "easeOutQuad");
$(this).find('div#TrainingActionButtons').hide("fast");
});
});
和HTML:
<tr>
<td class="EventNameList">
<div id="TrainingActionButtons">
Some text
</div>
</td>
</tr>
可能重複:http://stackoverflow.com/questions/4666227/jquery-issue-with-hoverintent-and-show-hide-for-div/4667207#4667207 – ifaour 2011-01-14 17:05:04