最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Jquery delay function execute - Stack Overflow

programmeradmin1浏览0评论

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 !!!

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 !!!

Share Improve this question asked Jun 21, 2013 at 19:53 user2501504user2501504 3113 gold badges7 silver badges15 bronze badges
Add a comment  | 

3 Answers 3

Reset to default 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.

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

Is this what you meant?

jQuery("#tem_forma").hide();
jQuery("#win").delay(3000).hide(1000);
发布评论

评论列表(0)

  1. 暂无评论