Skip to content

Instantly share code, notes, and snippets.

@webmasterninjay
Last active February 22, 2017 16:59
Show Gist options
  • Save webmasterninjay/9688a788263d9e0a26967a640f7a4050 to your computer and use it in GitHub Desktop.
Save webmasterninjay/9688a788263d9e0a26967a640f7a4050 to your computer and use it in GitHub Desktop.
jQuery('.video-thumb').click(function(){
var video = '<iframe width="573" height="322" src="'+ jQuery(this).attr('data-video') +'" frameborder="0" allowfullscreen></iframe>';
jQuery(this).replaceWith(video);
});
/*
* @data-video - use data-video attribute for video url
* @video-thumb - use 'video-thumb' class
* @example = <img class="video-thumb" src="/wp-content/uploads/2012/01/573x322.png" data-video="https://www.youtube.com/embed/MQ5sFO_iETg?autoplay=1" />
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment