Reputation: 53
is there any way to execute html()
, only when slideUp()
will be finished?
<p class="test">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent tortor elit</p>
$(".test").slideUp().html("");
I tried did it with Deferred and queue, but I failed.
Upvotes: 2
Views: 64
Reputation: 115242
Do it within the animation complete callback.
$(".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>
Upvotes: 5