Hi,
How can we run a script once complete page is loaded.
Following is the scenario where we are facing the problem-
1.Created a teaser.
2.Inside which we are having a carousel component.
But the issue we are facing is carousel script is not working inside a carousel.
So is there a way we can run a script after page is loaded or using any listener.
Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
Hi
As mentioned by Praveen you can use "window.onload" or
These solutions will also work:
<body onload="script();">
or
document.onload = function ...
or even
window.onload = function ...
Link:- http://stackoverflow.com/questions/807878/javascript-that-executes-after-page-load
Make sure not to use .ready(), as there is difference between .load and .ready.
$(document).ready(function() { // executes when HTML-Document is loaded and DOM is ready alert("document is ready"); }); $(window).load(function() { // executes when complete page is fully loaded, including all frames, objects and images alert("window is loaded"); });
I hope this helps you.
Thanks and Regards
Kautuk Sahni
Views
Replies
Total Likes
In page JSP, code a JQuery https://api.jquery.com/load-event/ event.
Views
Replies
Total Likes
You can use:
function load() { console.log("Page is loaded, now perform task"); } window.onload = load;
Views
Replies
Total Likes
Hi
As mentioned by Praveen you can use "window.onload" or
These solutions will also work:
<body onload="script();">
or
document.onload = function ...
or even
window.onload = function ...
Link:- http://stackoverflow.com/questions/807878/javascript-that-executes-after-page-load
Make sure not to use .ready(), as there is difference between .load and .ready.
$(document).ready(function() { // executes when HTML-Document is loaded and DOM is ready alert("document is ready"); }); $(window).load(function() { // executes when complete page is fully loaded, including all frames, objects and images alert("window is loaded"); });
I hope this helps you.
Thanks and Regards
Kautuk Sahni
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies