-
-
Save rafszul/a5dae0672cb8c573f807e9cfe8aad5d1 to your computer and use it in GitHub Desktop.
Youtube embedded overlay image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="video-container"> | |
<img src="img/yt-video.jpg"/ id="play-video" class="img-responsive"> | |
<iframe style="display:none" id="video" src="https://www.youtube.com/embed/SzmioR4Dj8E" frameborder="0" allowfullscreen></iframe> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
$('#play-video').on('click', function(ev) { | |
this.style.display = 'none'; | |
thevid = document.getElementById('video'); | |
thevid.style.display = 'block'; | |
$("#video")[0].src += "?autoplay=1"; | |
ev.preventDefault(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment