Created
June 28, 2016 16:43
-
-
Save pablo-sg-pacheco/a9ec62f1b0c898c36455fba109c3c475 to your computer and use it in GitHub Desktop.
Colorbox - Open youtube videos
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
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