mrpx
mrpx

Reputation: 95

Modify HTML Object tag attributes with mootools in IE

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.

Upvotes: 1

Views: 618

Answers (2)

Dimitar Christoff
Dimitar Christoff

Reputation: 26165

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.

Upvotes: 1

Oskar Krawczyk
Oskar Krawczyk

Reputation: 3502

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.

Upvotes: 0

Related Questions