views:

393

answers:

1

I've tried a few ways but nothing seems to work. What I'd like to do is have my users post video's with the given embed code (example):

<object id="cnbcplayer" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="380" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"&gt;
 <param name="type" value="application/x-shockwave-flash" />
 <param name="allowfullscreen" value="true" />
 <param name="allowscriptaccess" value="always" />
 <param name="quality" value="best" />
 <param name="scale" value="noscale" />
 <param name="wmode" value="transparent" />
 <param name="bgcolor" value="#000000" />
 <param name="salign" value="lt" />
 <param name="src" value="http://plus.cnbc.com/rssvideosearch/action/player/id/1398301408/code/cnbcplayershare" />
 <param name="name" value="cnbcplayer" />
 <embed id="cnbcplayer" 
        type="application/x-shockwave-flash" 
        width="400" 
        height="380" 
        src="http://plus.cnbc.com/rssvideosearch/action/player/id/1398301408/code/cnbcplayershare" 
        name="cnbcplayer" 
        salign="lt" 
        bgcolor="#000000" 
        wmode="transparent" 
        scale="noscale" quality="best" 
        allowscriptaccess="always" allowfullscreen="true">  
 </embed>

But then, I want to resize it to be 300px wide. I've tried updating the attributes with jQuery but that didn't work. Any ideas on what could solve this?

Thanks

A: 

Try to place object with width: "100%" into a div and resize that div container.

Darmen
This will work but makes the video width 100% always. I'm using this as a sidebar to a blog, so I would like to keep the correct aspect ratio in the post but preview the most recent videos on the homepage sidebar.I've tried using jQuery to update the attributes but it doesn't seem to work:jQuery('#sideVideo').closest('object').attr('width','100%');I am missing something on the jQuery side but am not sure what.
sshefer
Darmen - while this worked it was actually jQuery related - I guess I can't use "closest" and instead had to specify the child object I was trying to modify.
sshefer
Hmm... try `Query('#sideVideo').closest('object').parent("#yourDiv").attr('width','500px');` and specify `width: "100%"` to `object`.
Darmen