<js> $("#curtain").slideUp("slow"); $("#curtain").slideDown开发者_如何学运维("slow"); </js>
Now what do I do, if I want to add a delay of 100ms between the .slideUp and slideDown?
Since jQuery 1.4, it's as easy as
$("#curtain").slideUp("slow").delay(500).slideDown("slow");
On older version you had to use the animation callback and setTimeout:
$("#curtain").slideUp("slow", function(){
setTimeout(function(){ $("#curtain").slideDown("slow"); }, 500);
});
You can have it call a function when it completes an animation. Have a function called after the slideup, use a timer to wait 100ms, then call the slidedown
The trick here is to delay slideUp
and slideDown
.. this works for me:
$('#loading').show((1));
setTimeout(function(){
$('.toggle_container').slideUp(function () {
$('#loading').hide();
});
}, 500);
精彩评论