CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   DOM and JSON scripting (http://www.codingforums.com/forumdisplay.php?f=15)
-   -   Code issue, Using Json and Oembed for Vimeo (http://www.codingforums.com/showthread.php?t=284378)

ethanlphoto 12-19-2012 12:51 AM

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>

xelawho 12-19-2012 02:29 PM

I would think this property here:
Code:

{format: "json", "width": 900}
would be a good one to play around with (and please remove the trailing comma if you don't want IE to freak out)

rnd me 12-20-2012 12:57 AM

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.