0

Can anyone recommend the best way to pause a script until a second after page load?

Thanks paul

Dancer
  • 17,035
  • 38
  • 129
  • 206

3 Answers3

4

There are two approaches:

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

Both are explained here delay JQuery effects

Community
  • 1
  • 1
Alfabravo
  • 7,493
  • 6
  • 46
  • 82
0

I answered this a couple of days ago:

$(document).ready(function() {
    setTimeout(function() {
        ...  // put your body here
    }, 1000);
});
Alnitak
  • 334,560
  • 70
  • 407
  • 495
0

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...
});
Adam Albrecht
  • 6,680
  • 4
  • 31
  • 35