-1

I have this code below where I want when I click the button, it will wait about 3 seconds to repeat the action.

The code is this:

$( ".menu-show").css({ "visibility":"hidden", "opacity":"0" }),
    $( "#bt_web" ).hover(function() {
    $( ".menu-show").css({ "visibility":"visible"}),
    $( ".menu-show").animate({opacity: 1}, 500);
    }, function() {
        $( ".menu-show").css({ "visibility":"hidden"}),
        $( ".menu-show" ).animate({opacity: 0}, 300);
    });

    $( "#bt_web" ).hover(function() {
    $(this).animate({opacity: 0.2}, 500);
    }, function() {
        $(this).animate({opacity: 1}, 300);
    });

Is there any function in jquery that makes it similar like "setTimeout" of action script? thank you

Lucas Fernandes
  • 1,360
  • 2
  • 8
  • 12
  • http://stackoverflow.com/questions/9136261/how-to-make-a-setinterval-stop-after-some-time-or-after-a-number-of-actions might help. `:)` – Tats_innit May 06 '14 at 01:54

1 Answers1

1

Yes, you can use .delay() which delays in milliseconds the function.

An example would be:

$("#id").delay(600).fadeOut();

This would wait 600 milliseconds and then fadeOut().

(If this was what you were talking about)

JayRow
  • 131
  • 8
  • i would like when all this function over, i got a delay of 3 seconds to restart. is possible with this code ? – Lucas Fernandes May 06 '14 at 04:58
  • Well you could do something like run the function inside the function with a delay. So if the function was say `function()`, on the last line you would run `function().delay(500)` @chead – JayRow May 06 '14 at 12:43