简体   繁体   中英

jquery delay is happening after fadeout

I'm fading in and out 3 divs. the fadein and out works great, except the delay is happening after the div is faded out. the code:

runslide();

function runslide() {
    $('.expect').fadeIn(1500).delay(7500).fadeOut(2000, function () {
        $('.marketing').fadeIn(1500).delay(7500).fadeOut(2000, function () {
            $('.consider').fadeIn(1500).delay(7500).fadeOut(1000, function () {
                runslide();
            });
        })
    });
}

here is the file I am working on: http://goo.gl/8xt1XZ , it is the slider after the text.

change the code like this

runslide();

function runslide() {
$('.expect').fadeIn(1500).fadeOut(2000, function() {
$('.marketing').fadeIn(1500).fadeOut(2000, function() {
    $('.consider').fadeIn(1500).fadeOut(1000, function(){
    runslide();
});
})
});
}

DEMO

The delay seems to be working fine. You do have a missing semicolon but I don't think that's the problem. I'm not sure what the problem is on your site. I tried it with jQuery version 1 and 2 and both seems to be working fine.

http://jsfiddle.net/csrow/5t4rL/2/

$('.expect').hide();
$('.marketing').hide();
$('.consider').hide();
runslide();

function runslide() {
    $('.expect').fadeIn(1500).delay(7500).fadeOut(2000, function () {
        $('.marketing').fadeIn(1500).delay(7500).fadeOut(2000, function () {
            $('.consider').fadeIn(1500).delay(7500).fadeOut(1000, function () {
                runslide();
            });
        });
    });
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM