Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-19-2012, 12:51 AM   PM User | #1
ethanlphoto
New to the CF scene

 
Join Date: Dec 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
ethanlphoto is an unknown quantity at this point
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>
ethanlphoto is offline   Reply With Quote
Old 12-19-2012, 02:29 PM   PM User | #2
xelawho
Senior Coder

 
xelawho's Avatar
 
Join Date: Nov 2010
Posts: 2,437
Thanks: 52
Thanked 454 Times in 452 Posts
xelawho will become famous soon enoughxelawho will become famous soon enough
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)
xelawho is offline   Reply With Quote
Users who have thanked xelawho for this post:
ethanlphoto (12-20-2012)
Old 12-20-2012, 12:57 AM   PM User | #3
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,468
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
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>.
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:17 AM.


Advertisement
Log in to turn off these ads.