Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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