Created
March 18, 2016 11:43
-
-
Save websupporter/95fe3379bcbb49131e25 to your computer and use it in GitHub Desktop.
JS Handling for Youtube Thumbnail Replace
This file contains 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
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