Loading iframe into jQuery popup only on click

I am using jQuery to create popups using iframe. There are a lot of frames on my pages that are very slow to load the whole page. I would like to delay the loading of the src iframes until a click is made. Here is the code I'm using:

<a class='COD_open' href='#cod'>COD</a>
<div id='COD' class='well'>
   <iframe name='I1' src='Freq/cod.html' width='500' height='500' ></iframe>
</div>
<script> 
   $(document).click(function () {$('#COD').popup({pagecontainer: '.container',transition: 'all 0.3s'});}); 
</script>

      

There is a similar Q&A suggesting using getElementById here , but I have not been able to implement this technique in my code. Any help would be greatly appreciated.

+3
jquery iframe popup onclick


source to share


No one has answered this question yet

See similar questions:

nine
Load only div iframe onclick
nine
How to make <iframes> load only on button click?

or similar:

7428
How can I check if an element is hidden in jQuery?
4523
Thinking in AngularJS if I have a jQuery background?
4345
How can I check if a checkbox is checked in jQuery?
3952
Setting "checked" for a checkbox with jQuery?
2644
Is there a function "exists" for jQuery?
2329
How do I detect a click outside of an element?
2302
Add table row in jQuery
2101
jQuery scroll to element
1957
Disable / enable input with jQuery?
763
jQuery / JavaScript: Accessing Iframe Content



All Articles
Loading...
X
Show
Funny
Dev
Pics