1
我不是Jquery的專家,但採用了一個模板,它的工作原理,但試圖修改它,以便任何添加的延遲類隨後消失延遲。添加一個延遲的類到隊列中,但想要在進一步延遲後刪除它
此代碼正確地應用了一個帶有數據延遲ms延遲的'animated'類,但希望它稍後移除帶有數據延遲ms的'動畫'類 - 嘗試將隊列鏈接在一起但未起作用 - 基本代碼應用下面顯示的'動畫'類。
jQuery('.sr-animation').each(function() {
if (jQuery(window).width() > 700) {
var visible = jQuery(this).visible(true);
var indelay = jQuery(this).attr("data-indelay");
var outdelay = jQuery(this).attr("data-outdelay");
if (!indelay) { indelay = 0; }
if (!outdelay){ outdelay = 0; }
if (jQuery(this).hasClass("animated")) {
} else if (visible) {
jQuery(this).delay(indelay).queue(function(){jQuery(this).addClass('animated')});
}
} else {
jQuery(this).addClass('animated');
}
});
任何幫助感激地接受,因爲我從我的深度在這裏。
找到一個解決方案..不是很確定什麼dequeue()做,但似乎工作.. – 2015-02-06 17:42:07