简体   繁体   English

淡出后发生jQuery延迟

[英]jquery delay is happening after fadeout

I'm fading in and out 3 divs. 我正在淡入淡出3格。 the fadein and out works great, except the delay is happening after the div is faded out. 淡入和淡出效果很好,除了在div淡出后发生延迟。 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. 这是我正在处理的文件: http : //goo.gl/8xt1XZ ,它是文本后面的滑块。

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. 我在jQuery 1和2版本中尝试过,两者似乎都可以正常工作。

http://jsfiddle.net/csrow/5t4rL/2/ 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();
            });
        });
    });
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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