Skip to content

Instantly share code, notes, and snippets.

@aradnom
Created July 29, 2014 21:29
Show Gist options
  • Save aradnom/0222ed226787de96e400 to your computer and use it in GitHub Desktop.
Save aradnom/0222ed226787de96e400 to your computer and use it in GitHub Desktop.
Simple Vimeo embed example wrapping existing video iframe.
/* Vimeo */
window.vimeo_players = [];
$('.video_container.vimeo').each( function () {
$f($(this).find('iframe')[0]).addEvent( 'ready', (function ( player_id ) {
if ( ! $(this).hasClass('no_thumbnail') ) {
var thumbnail = $(this).find('.video_thumbnail'),
play = $(this).find('.video_play'),
player = $f( player_id );
window.vimeo_players.push( player );
var thumbnail_height = thumbnail.find('img').height();
$(this).height(thumbnail_height);
// Play button
play.click( function () {
player.api( 'play' );
thumbnail.fadeTo( 200, 0, function () {
thumbnail.css( 'z-index', 0 );
});
});
}
}).bind( this ));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment