Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<script type="text/javascript">
function init() {
var vidDefer = document.getElementsByTagName('iframe');
for (var i=0; i<vidDefer.length; i++) {
if(vidDefer[i].getAttribute('data-src')) {
vidDefer[i].setAttribute('src',vidDefer[i].getAttribute('data-src'));
}
}
} window.onload = init;
</script>
// The Html
<iframe width="560" height="315" src="" data-src="https://www.youtube.com/embed/fBCAOjAS9d4" frameborder="0" allowfullscreen></iframe>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment