Skip to content

Instantly share code, notes, and snippets.

@JackuB
Created June 14, 2012 11:24
Show Gist options
  • Save JackuB/2929733 to your computer and use it in GitHub Desktop.
Save JackuB/2929733 to your computer and use it in GitHub Desktop.
Youtube video to div
<div id="video_container"></div>
<a href="bMvRdr-mUOU" class="vid_trigger">
<script type="text/javascript">
$('.vid_trigger').click( function(e){
e.preventDefault();
var URL = $(this).attr('href');
var htm = '<iframe width="615" height="460" src="http://www.youtube.com/embed/' + URL + '?autoplay=1&wmode=transparent" frameborder="0" allowfullscreen ></iframe>';
$('#video_container').html(htm);
return false;
});
</script>
@bluesatsuma
Copy link

Hi

I have tested this on an Ipad and it will only change a video if one is playing otherwise no response from links.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment