Created
August 16, 2013 16:00
-
-
Save kisin/6251139 to your computer and use it in GitHub Desktop.
embed 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
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 + | |
'&wmode=transparent" frameborder="0" />'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment