I volunteer for a prostate cancer group and we have a website that has a number of YouTube videos embedded. We have so much now that the page gets bogged down when loading, even though each video is hidden in an onClick div.
Question: Is there a simple way to make it so div's only load the content when they are clicked upon? (ie. the page will not pull the YouTube embed until it is triggered with a click?)
Here's the webpage with all the videos, click on any of the lines to pull up what I'd like to be just loaded after the click:
http://pccncalgary.org/v_archive.php
Here is a snippet of code for what each of the hidden divs looks like:
<p class="subHeader">
<a onMouseOver="this.style.cursor='pointer';" onclick="toggle_visibility('nov14');$(this).text($(this).text() == '[+] New Drugs in the Prostate Cancer Clinic ' ? '[-] New Drugs in the Prostate Cancer Clinic ' : '[+] New Drugs in the Prostate Cancer Clinic ');">[+] New Drugs in the Prostate Cancer Clinic </a>
</p>
<div id="nov14" style='display:none;'>
<table width="400" style="background-color:#4f4f4f;border:3px solid #333;" align="center" cellpadding="5" cellspacing="5">
<tr>
<td>
<iframe width="400" height="254" src="//www.youtube.com/embed/XvfzhBrK_SQ" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
</td>
</tr>
</table>
</div>
The response from this Stack Overflow post seems right, but I'm not entirely sure how to make it work with the coding I have above. Any help would be greatly appreciated by all our members!