开发者

Jquery Script pauses

开发者 https://www.devze.com 2023-02-18 23:51 出处:网络
Can anyone recommend th开发者_C百科e best way to pause a script until a second after page load? Thanks

Can anyone recommend th开发者_C百科e best way to pause a script until a second after page load?

Thanks paul


There are two approaches:

  1. setTimeout JS plain-and-simple JS standard.
  2. delay(n) jQuery method.

Both are explained here delay JQuery effects


I answered this a couple of days ago:

$(document).ready(function() {
    setTimeout(function() {
        ...  // put your body here
    }, 1000);
});


By enclosing your script inside the following jQuery code, execution will be delayed until after everything in your page has loaded:

$(function() {
  // your code goes here...
});
0

精彩评论

暂无评论...
验证码 换一张
取 消