jQuery-等待淡出完成,然后再运行淡入 [英] jQuery - Waiting for the fadeOut to complete before running fadeIn
本文介绍了jQuery-等待淡出完成,然后再运行淡入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道在淡入淡出开始之前是否有任何方法可以等到淡出完成,因为当我运行以下代码时,它将一个div放在另一个下面,然后当淡出时它向上移动...看起来有点难看.
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, then when its faded out it moves up ... looks a little ugly.
代码如下:
$('.sidebarform').fadeOut('slow');
$('.sidebarsuccess').fadeIn('slow');
推荐答案
fadeOut
函数有一个在完成动画后执行的回调:
The fadeOut
function has a callback that it executes when the animation is done:
$('.sidebarform').fadeOut('slow', function() {
$('.sidebarsuccess').fadeIn('slow');
});
这篇关于jQuery-等待淡出完成,然后再运行淡入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文