jQuery - Waiting for the fadeOut to complete before running fadeIn

后端 未结 3 812
半阙折子戏
半阙折子戏 2020-12-11 00:03

I was wondering if the is any way to wait until the fadeOut is complete before the fadeIn commences, as when i run the following code, it places one div under the other, the

3条回答
  •  攒了一身酷
    2020-12-11 00:30

    Another option is using promise which will wait for all pending animations on .sidebarform to complete first even if they were started elsewhere:

    $('.sidebarform').fadeOut('slow').promise().done(function() {
        $('.sidebarsuccess').fadeIn('slow');
    });
    

提交回复
热议问题