开发者

Simple jQuery Fading Sequence problem

开发者 https://www.devze.com 2023-02-10 08:07 出处:网络
I\'m looking for a little help with my jQuery fading sequence. My Code: $(\'#1\').fadeOut(\'fast\'); $(\'#1same\').fadeOut(\'fast\');

I'm looking for a little help with my jQuery fading sequence.

My Code:

$('#1').fadeOut('fast');
$('#1same').fadeOut('fast');
$('#fadeinme').fadeIn('slow');

I'm looking to add a 1 second delay a开发者_Python百科fter the first 2 (#1 & #1same fade out at the same time) before the 3rd fades in.

Thanks!


We can use the completed callback to execute the fadeIn after the first animation has completed, then use .delay to add the one second delay:

$('#1, #1same').fadeOut('fast', function(){
    $('#fadeinme').delay(1000).fadeIn('slow');
});

Do note that in HTML4, ids cannot start with a number.

0

精彩评论

暂无评论...
验证码 换一张
取 消