6

I want execute 2 functions in jquery but i need the second function execute after 3 seconds more or less , i try this , but if use this , the second function of jquery never execute finally , i put the script i create and i try works continue :

   jQuery("#tem_forma").hide();
    delay(3000);
    jQuery("#win").hide(1000);

How i can use delay function for wait 3 seconds for execute the next function , in this case the second

Thank´s , Regards !!!

4

3 回答 3

13

Use setTimeout

jQuery("#tem_forma").hide();
setTimeout( function() {  jQuery("#win").hide(1000); }, 3000);

This will make sure your functions gets executed after 3 seconds.

于 2013-06-21T19:54:26.093 回答
1

You can use .delay() like this:

jQuery("#tem_forma").hide();
jQuery("#win").delay(3000).hide(1000);

But be aware that .hide() needs to have (time) parameter to work in conjunction with .delay()

于 2013-06-21T19:54:56.910 回答
0

Is this what you meant?

jQuery("#tem_forma").hide();
jQuery("#win").delay(3000).hide(1000);
于 2013-06-21T19:54:55.007 回答