Skip to content

Instantly share code, notes, and snippets.

@websupporter
Created March 18, 2016 11:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save websupporter/95fe3379bcbb49131e25 to your computer and use it in GitHub Desktop.
Save websupporter/95fe3379bcbb49131e25 to your computer and use it in GitHub Desktop.
JS Handling for Youtube Thumbnail Replace
jQuery( document ).ready( function(){
jQuery( '.youtube-wrapper img' ).click( function(){
var id = jQuery( this ).parent().attr( 'data-youtube' );
var html = '<iframe width="480" height="270" src="https://www.youtube.com/embed/' + id + '?feature=oembed" frameborder="0" allowfullscreen></iframe>';
jQuery( this ).parent().html( html );
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment