Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Wordpress colorbox youtube
jQuery(document).ready(function($){
$('a[href^="https://www.youtube.com"]').colorbox({iframe:true, innerWidth:640, innerHeight:390, maxWidth:'95%', maxHeight:'95%', href:function(){
var videoId = new RegExp('[\\?&]v=([^&#]*)').exec(this.href);
if (videoId && videoId[1]) {
return 'https://youtube.com/embed/'+videoId[1]+'?rel=0&wmode=transparent&autoplay=1';
}
}});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment