Jquery Script pauses
Can anyone recommend th开发者_C百科e best way to pause a script until a second after page load?
Thanks paul
There are two approaches:
- setTimeout JS plain-and-simple JS standard.
- 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...
});
精彩评论