Jon
Jon

Reputation: 173

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?

Upvotes: 1

Views: 1055

Answers (3)

jack
jack

Reputation: 81

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

Upvotes: 0

Kobi
Kobi

Reputation: 138147

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

Upvotes: 1

Jay
Jay

Reputation: 14481

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

Upvotes: 0

Related Questions