Skip to content
Advertisement

How to delay JS function from running until 5 seconds after page loads

I want this to run but so that it doesn’t for 5 seconds after the page fully loads. How would I go about achieving this, I believe its a ,500 somewhere but I am not sure where this would go.

If you have any questions please ask!

Thank you in advance for you help on this matter, its very much appreciated!

JavaScript
JavaScript
JavaScript

Advertisement

Answer

Since you want the function to be fired up 5 seconds after the page is fully loaded you will be using a combination of two functions.

I see you are using jQuery in your website The below code waits until the page is fully loaded then fires up the code inside the brackets.

JavaScript

So inside the above code you will add your 5 seconds waiting function

JavaScript

The final code is

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement