Skip to content

Instantly share code, notes, and snippets.

@pablo-sg-pacheco
Created June 28, 2016 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pablo-sg-pacheco/a9ec62f1b0c898c36455fba109c3c475 to your computer and use it in GitHub Desktop.
Save pablo-sg-pacheco/a9ec62f1b0c898c36455fba109c3c475 to your computer and use it in GitHub Desktop.
Colorbox - Open youtube videos
jQuery(".a-video").colorbox({
rel: 'a-video',
iframe: true,
innerWidth: 640,
innerHeight: 390,
href: function () {
var videoId = new RegExp('[\\?&]v=([^&#]*)').exec(this.href);
if(videoId && videoId[1]){
return 'http://youtube.com/embed/' + videoId[1] + '?rel=0&wmode=transparent';
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment