开发者

How do I add a delay to the .slideUp function in Balsamiq Mockups?

<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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜