Custom Vimeo player for Tumblr
********
UPDATE 11/22/2010
This code has now been updated for the new vimeo embed code.
********
Based on Matthew Buchanan’s code. Just change the value for ‘newW’ and the vimeo player’s height will scale accordingly.
The script works with tubmlr themes that use jQuery and have post widths greater than 500px.
Add the below code to your theme. Change the value for newW to your desired vimeo player width.
<script type="text/javascript">
$(function() {
var color = "55AAAA";
$("iframe").each(function() {
var $obj = $(this);
var data = $obj.attr("data");
var vsrc = $obj.attr("src");
var oldW = $obj.attr("width");
var newW = 600;
var oldH = $obj.attr("height");
var p = oldW/newW;
var newH = (oldH / p);
if (vsrc.search("vimeo") > 0) {
$obj.replaceWith("<iframe src='"+vsrc+"?color="+color+"' width='"+newW+"' height='"+newH+"' frameborder='0'></iframe>");
}
});
})
</script>
-
prter liked this
-
lettertojane liked this
-
hazel liked this
-
snackish liked this
-
vivesomnium liked this
-
mdmanodyne reblogged this from alexhallajian
-
dtsenses liked this
-
jarelion liked this
-
aymansanliturk liked this
-
nativepaul liked this
-
katiepalmersketchbook reblogged this from alexhallajian
-
edmurphypal liked this
-
futuretapes liked this
-
35mmclicks liked this
-
michaelsigler liked this
-
cesjeunes liked this
-
ropelaturiof liked this
-
lunelson liked this
-
ohlin liked this
-
9929125 liked this
-
thehurricanekid reblogged this from check-it
-
eskimoguy liked this
-
burningfp liked this
-
jaymonstaa liked this
-
check-it reblogged this from alexhallajian and added:
And alter “var color = “55AAAA”;” to the embed color you desire....This code allows...
-
alexhallajian posted this
