View Full Version : Frame Resize
real_estate
07-21-2006, 05:12 AM
How can dynamically resize a frame when the mouse passes over it?
jscheuer1
07-21-2006, 06:00 AM
That could get really complicated depending upon just what you mean but, a simple answer is to give the iframe a mouseover event that changes its width and/or height attribute values. Ex:
<iframe id="theFrame" src="iframe_over_ex.htm" width="350" height="500" scrolling="auto" frameborder="0" onmouseover="this.width=550;"></iframe>
That will work in IE and FF but for Opera, you also need something like so on the page showing through the iframe:
<body onmouseover="parent.document.getElementById('theFrame').onmouseover();">
either added to the body tag as shown above or as a part of a script on or linked to the page. If it is used as a part of a script, the syntax would be different.
And the latter code won't work across multiple domains.
jscheuer1
07-21-2006, 06:16 AM
And the latter code won't work across multiple domains.
True, very little javascript works across domains - parent window to child window and visa versa.
Probably if you had a division around the iframe with some padding, you could work it out so that Opera wouldn't need any extra code on the content page but, it would require some extra code associated in some way with this container division of the iframe.
jscheuer1
07-21-2006, 06:22 AM
In fact, if you were willing to give the iframe itself some fairly hefty padding, it could work in Opera without any code on the content page.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.