如何使用js-setTimeout延迟此文本的淡入

how to delay this text fade on with js setTimeout?

本文关键字:文本 淡入 延迟 何使用 js-setTimeout      更新时间:2023-09-26

如何使用setTimeout延迟此事件(文本滑入框架)?

//fadeIn active slide
$($containerClass+' .swiper-slide:nth-child('+ (currentSlide + 1) +')').find('.content').children().each(function(i){
    $(this).delay(i*90).animate({
        'opacity' : 1,
        'padding-top' : 0
    },{ duration: 400, easing: 'easeOutQuad'}); 
});

我无法重新创建您的确切场景,所以我创建了一个jsfiddle来满足您的要求。

演示

小提琴中使用的Javascript:

// Iterate over slides
$.each($(".slide"), function (i, o) {
    // settimeout
    setTimeout(function () {
        $(o).animate({
            left: "+=420"
        }, 400, function () {
            // Do something
        });
    }, i * 1000); // Increment the wait
});