繁体   English   中英

jQuery slideUp()完成后如何运行代码?

[英]How to run code when jquery slideUp() finished?

有什么方法可以执行html() ,只有在slideUp()完成时才能执行?

<p class="test">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent tortor elit</p>
$(".test").slideUp().html("");

我尝试用Deferred和queue来做,但是失败了。

动画complete回调中执行此操作

$(".test").slideUp(function(){ 
  $(this).html(""); 
});

 $(".test").slideUp(2000,function() { $(this).html(""); }); 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <p class="test">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent tortor elit</p> 

暂无
暂无

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

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