Created
June 20, 2011 18:07
-
-
Save OscarGodson/1036156 to your computer and use it in GitHub Desktop.
Tumblr + Vimeo Mod To Make Videos Larger Than 500
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
/** | |
* Makes Vimeo videos on Tumblr larger than the max of 500px that Tumblr forces | |
* Change the 650 to whatever you want, but do NOT add px or % | |
* The height, by default, is set to auto which will calculate the 16:9 video size. | |
* You can set the height to a static number as well if you want. | |
* If you have any questions feel free to ask me: @oscargodson | oscargodson.com | |
*/ | |
(function(){ | |
var iframes = document.body.getElementsByTagName('iframe') | |
, newVimeoWidth = 650 | |
, newVimeoHeight = 'auto'; | |
for(x in iframes){ | |
if(iframes[x].src && iframes[x].src.indexOf('player.vimeo.com') > -1){ | |
if(newVimeoHeight == 'auto'){ | |
newVimeoHeight = ( newVimeoWidth * 9 ) / 16; | |
} | |
iframes[x].width = newVimeoWidth; | |
iframes[x].height = newVimeoHeight | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment