Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
154
rated 0 times [  158] [ 4]  / answers: 1 / hits: 52436  / 15 Years ago, mon, october 19, 2009, 12:00:00

I know there are some tools and techniques for delaying the load of javascript, but I have an iframe that I would like to delay loading until after the rest of the page has finished downloading and rendering (the iframe is in a hidden that will not be revealed until someone clicks on a particular tab on the page. Is there a way to delay the load of an iframe? Any suggestions would be much appreciated. Thanks!


More From » iframe

 Answers
71

with jquery it is easy!



either enclose your code which loads the iframe within a $()
or use $(document).ready(function(){})
these both are the same and would execute your code after the DOM is ready!



e.g.



$(document).ready(function(){
$('iframe#iframe_id').attr('src', 'iframe_url');
});


see more at http://www.learningjquery.com/2006/09/introducing-document-ready


[#98490] Wednesday, October 14, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
leog

Total Points: 225
Total Questions: 113
Total Answers: 118

Location: Oman
Member since Wed, Apr 12, 2023
1 Year ago
;