Link to home
Start Free TrialLog in
Avatar of Bob-Villa
Bob-Villa

asked on

IE parent scrollheight after iframe resize

I use modal windows with a translucent background.
On the page that uses these windows I have an iframe that holds dynamic content and changes height.

Example.

page load iframe=1000px (H) set by style="height:1000px"
a click on content in iframe reloads it's content and parent.document.getElementById("iMPFrame").style.height changes to 500px (H) via some javascript code.
This works fine, the parent's scrollbar (in client's browser) disappears.
However, the parent's scrollHeight (parent.document.body.scrollHeight) still is set at 1000px. even though the true scrollHeight is a little over 500px.
When I launch the modal window the background assumes the old scrollHeight of 1000px (+surrounding content) instead of the correct value of 500px (+ surrounding content)

I can calculate the true height of the page by getting the iframe height + 96px but wonder why this is not working.

How can I get the correct scrollHeight of the parent without refreshing the parent?







<body>
 
<iframe style="height:1000px" id="frame1" src="dynScript.pl"></iframe>
 
<body>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Zyloch
Zyloch
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial