Skip to content

Instantly share code, notes, and snippets.

@kisin
Created August 16, 2013 16:00
Show Gist options
  • Save kisin/6251139 to your computer and use it in GitHub Desktop.
Save kisin/6251139 to your computer and use it in GitHub Desktop.
embed youtube videos
function embedYoutube(link, ops) {
var o = $.extend({
width: 480,
height: 320,
params: ''
}, ops);
var id = /\?v\=(\w+)/.exec(link)[1];
return '<iframe style="display: block;" type="text/html" ' +
' width="' + o.width + '" height="' + o.height + '"' +
' src="http://www.youtube.com/embed/' + id + '?' + o.params +
'&amp;wmode=transparent" frameborder="0" />';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment