例如,我在$ .ajax函数中使用beforeSend选项.在下面的代码示例中,.html函数将在之前的语句中发生淡出时执行.我怎么能阻止这种行为?
jQuery("#container").fadeOut("slow", function() {
jQuery("#container").removeClass('error');
});
jQuery("#container").html("success").fadeIn("slow");
Run Code Online (Sandbox Code Playgroud)
所以会发生的是,在淡出期间,jquery将注入html"成功".我希望它在动画完成后发生.
我该怎么办呢?
谢谢!
使用回调...
jQuery("#container").fadeOut("slow", function() {
// At this point, animation is complete, and the element is invisible
jQuery(this).removeClass("error").html("success").fadeIn("slow");
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2066 次 |
| 最近记录: |