Last active
December 21, 2015 10:28
-
-
Save sTiLL-iLL/6291915 to your computer and use it in GitHub Desktop.
Generate a embed widget on the fly!
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
//store the URL | |
var url = "http://vimeo.com/71673549"; | |
//extract the ID | |
var rgx = /\/\/(www\.)?vimeo.com\/(\d+)($|\/)/; | |
//the ID: 71673549 | |
var id = url.match(rgx); | |
var width = '640'; | |
var height = '360'; | |
//make embed code and wrap it | |
var $embd = $("<div id='myEmbed'/>") | |
.append('<div class="vimeo-article"><iframe src="http://player.vimeo.com/video/'+id+ | |
'?title=0&byline=0&portrait=0&badge=0&color=ffffff" width="'+width+'" height="'+height+ | |
'" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>'); | |
//write it to the page | |
$("body").append($embd).show(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment