2016-03-21 89 views
1

有没有办法延迟jQuery中的CSS更改?延迟更改css

使用此代码,我设法陆续消失在一个元素:

$(".crea-card").each(function(index) { 
    $(this).delay(400*index).fadeIn(300); 
}); 

但是,使用这一项,CSS特效都可以应用在同一时间:

$(".crea-card").each(function(index) { 
     $(this).delay(400*index).css('opacity', 1); 
     $(this).delay(400*index).css('transform', 'translate(0,0)'); 
}); 

哪有我推迟他们,使不透明度一个接一个地设置为1?

(我知道CSS和jQuery不相同的行为)

回答

3

使用方法如下:

$(".crea-card").each(function(index) { 
    .delay(800) 
    .queue(function (next) { 
    $(this).css('opacity', 1); 
    $(this).css('transform', 'translate(0,0)'); 
    next(); 
    });