Execute JS function after some time loading the page
3 answers
Try the following:
The onload event fires at the end of the document loading process. At this point, all objects in the document are in the DOM, and all images, scripts, links and subframes are finished, after which
onload
you can usesetTimeout
to delay execution of your function.
var myFunc = function() {
alert('After 3 seconds of page load!');
}
window.onload = function() {
setTimeout(myFunc, 3000);
}
0
source to share