views:

28

answers:

2

Hi,

I got an object tag (generated by SWFObject) which I'ld like to modify width and height properties on window resize with mootools library. With a : $('my_object').set({ 'width': new_width, 'height': new_height }); everything working fine in a firefox, chrome and others. Unfortunately, Internet explorer (7 & 8) don't see it the same. It gives me an error saying "Object does not support this property or method".

Does anyone know why this problem or how to avoid it ?

Thanks to all.

A: 

The problem is as the error states "Object does not support this property or method". <object> is not extended with MooTools properties on IE because it's a ActiveX control, not a true element, hence it will not have any Element methods applied to it.

Oskar Krawczyk
+1  A: 

whereas you may not apply mootools methods to activex objects or elements in IE as they are not extended, you may be able to do something else instead.

create a wrapper element, like around the embedded object. set the width and height of that via CSS and then set width and height of the object/element to 100% so it follows the parent wrapper. then apply the resizing to the wrapper and the object will follow.

here's a quick example i tried that works in ie8: http://www.jsfiddle.net/dimitar/V5mQr/6/

good luck.

Dimitar Christoff
Nice. It works great. It's so simple, I didn't think about it.Thanks a lot.
mrpx
heh, feel free to upvote/accept the solution ;-P
Dimitar Christoff