Skip to content

Instantly share code, notes, and snippets.

@anneallen
Last active March 9, 2016 21:37
Show Gist options
  • Save anneallen/260e1a7a58b0e3a4e1e0 to your computer and use it in GitHub Desktop.
Save anneallen/260e1a7a58b0e3a4e1e0 to your computer and use it in GitHub Desktop.
video splash for vimeo and youtube embeds
<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>
@anneallen
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment