[英]How to do animations of mouse events occur in order?
我在某些元素中有一些鼠標事件,如下所示。
$("div").on("mouseenter mouseleave", function(){
$(this).toggleClass("bigDiv", 1000);
});
問題是:如果觸發了兩個或更多鼠標事件,它們將不等待先前的完成事件觸發,而是立即觸發。 他們如何等待時間?
提前致謝。
試試看:
jQuery(function($) {
$("div").on("mouseenter", function(){
if(!$('div').is(':animated'))
$(this).addClass("bigDiv", 1000);
});
$("div").on("mouseleave", function(){
$(this).removeClass("bigDiv", 1000);
});
});
這就是你想要的嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.