Last active
March 9, 2016 21:37
-
-
Save anneallen/260e1a7a58b0e3a4e1e0 to your computer and use it in GitHub Desktop.
video splash for vimeo and youtube embeds
This file contains hidden or 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
<div class="video-container"> | |
<img src="...splash.jpg" alt="my splash" width="901" height="513" class="videosplash aligncenter size-full wp-image-1970" data-video="https://player.vimeo.com/video/xyz123?title=0&byline=0&portrait=0andamp;autoplay=1" /> | |
</div> | |
<script type="text/javascript"> | |
jQuery(function( $ ){ | |
$('img').click(function(){ | |
var video = '<iframe src="'+ $(this).attr('data-video') +'"></iframe>'; | |
$(this).replaceWith(video); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Props to Wesley Murch
http://stackoverflow.com/questions/13725683/how-to-add-a-splash-screen-placeholder-image-for-a-youtube-video
Just wanted easy access to use again, so created a gist for myself.Thanks