Can any one please help me solve this.
I am resizing some flash object/embed code to fit the browser window using jquery. Please see HTML below.
HTML
<div id="prezi">
<object id="prezi_3453246342644353463435463456435" width="1000" height="800">
<embed width="1000" height="800" ></embed>
</object>
</div>
JQUERY (THIS WORKS)
function preziresize() {
var $objectId = $('#prezi_3453246342644353463435463456435'),
$objectEmbed = $objectId.find('embed'),
windowWidth = $(window).width(),
windowHeight = $(window).height();
$objectId.attr( 'height' , windowHeight ).attr( 'width' , windowWidth );
$objectEmbed.attr( 'height' , windowHeight ).attr( 'width' , windowWidth );
}
$(document).ready(function() {
preziresize();
});
$(window).resize(function() {
preziresize();
});
MY PROBLEM
But the downfall of the script above, is that I have to manually put the ID of my object into my script. :(
On my new script, which is not working, I am trying to automatically get the id of the object, and assign it as a variable. Please see my function below.
function preziresize() {
var $objectId = $('#prezi').attr( 'id' ),
$objectEmbed = $objectId.find('embed'),
windowWidth = $(window).width(),
windowHeight = $(window).height();
$objectId.attr( 'height' , windowHeight ).attr( 'width' , windowWidth );
$objectEmbed.attr( 'height' , windowHeight ).attr( 'width' , windowWidth );
}
Any pointers would be great thanks.
Josh