![]() |
Code issue, Using Json and Oembed for Vimeo
So i am trying to use Oembed and Json to automatically embed the newest Vimeo video from my channel on the homepage of my website. I got it to embed the video and all but the problem is resizing the video. It always comes in too big and i can't figure out how to fix it. Here is what i have, any help would be great!
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script> <script type="text/javascript"> $(function() { $.getJSON('http://vimeo.com/api/v2/gavinrudy/videos.json?callback=?', {format: "json"}, function(videoList) { $.getJSON('http://vimeo.com/api/oembed.json?url=http%3A//vimeo.com/' + videoList[0].id + '&byline=false&portrait=false&callback=?', {format: "json", "width": 900,}, function(videoProperties) { document.getElementById("vimeoRecent").innerHTML=videoProperties.html document.getElementById("vimeoDescription").innerHTML="<p><a href='" + videoList[0].url + "'>" + videoProperties.title + "</a> from <a href='" + videoProperties.author_url + "'>" + videoProperties.author_name + "</a> on <a href='http://vimeo.com'>Vimeo</a>.</p><p>" + videoProperties.description + "</p>" }); }); }); </script> |
I would think this property here:
Code:
{format: "json", "width": 900} |
you can use CSS to style the iframe, and the video will resize to fill the iframe as best it can.
a "width: 400px !important;" in css will cascade over both <iframe width=500> and <iframe style=width:500px>. |
| All times are GMT +1. The time now is 01:22 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.