JQuery wait x seconds after document ready

前端 未结 4 769
一个人的身影
一个人的身影 2020-12-05 09:33

following code waits till dom ready

jQuery(document).ready(function(){

what do i have to write to simple let the execution of the jquery fu

相关标签:
4条回答
  • 2020-12-05 09:51

    Read about setTimeOut(). http://www.w3schools.com/jsref/met_win_settimeout.asp

    0 讨论(0)
  • 2020-12-05 09:52

    Wrap your existing function with a call to setTimeout, ie, replace your current:

    jQuery(document).ready(function() {
         ....
    });
    

    with

    jQuery(document).ready(function() {
        setTimeout(function() {
             ....
        }, 2000);
    });
    
    0 讨论(0)
  • 2020-12-05 10:00

    You can use

    $(window).load(function(){}); 
    

    instead of

    $(document).ready(function(){});
    

    I took reference from jquery forum

    0 讨论(0)
  • 2020-12-05 10:09

    By using window.setTimeout.

    0 讨论(0)
提交回复
热议问题