[英]foreach delay fadein jquery
I'm trying to delay my css fade in for each div using jquery. 我正在尝试使用jquery延迟每个div的css淡入。 I need the elements to fade in one after the other.
我需要元素彼此之间逐渐消失。 At the moment they are simply fading in at the same time.
目前,它们只是在同时消失。
Here is my jquery: 这是我的jQuery:
$(".service").each(function(i, el) {
var el = $(el);
if (el.visible(true)) {
$(this).delay(800*i, function(){
el.addClass("animated fadeInDown");
});
}
});
Please help. 请帮忙。
Use setTimeout: 使用setTimeout:
$(".service").each(function (i, el) {
var el = $(el);
if (el.visible(true)) {
setTimeout(function () {
el.addClass("animated fadeInDown");
}, 800 * i);
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.