Dag Sunde wrote:
I have the following function to resize a div element
(Content) depending on the
size of another div element (leftConent).
function adjustContentHeight() {
var content = document.getElementById("Content");
var leftOne = document.getElementById("leftContent ");
content.style.height = (leftOne.offsetHeight + leftOne.offsetTop) +
"px";
return true;
}
This code works as expected in IE6 and FF2.0, but when
testing in IE7 nothing
happens... the "Content" div is not resized.
Can anyone shed some light on why?
CSS changes in IE 7 appear to be having knock-on effects for scripts.
Earlier in the week I traced an instance of a block of dynamically
generated elements not showing in IE 7 to a containing DIV that had been
set to position:relative, and as a result had started reporting zero
offsetWidth, wen though it had width:100% and a screen-width CSS
positioned container (probably a consequence of that DIV only having
absolutely positioned descendants and so not having any flowable
content). Switching the DIV to position:absolute solved that problem as
then the DIV did report its offsetWidth as non-zero (and it had never
needed to be relatively positioned to start with).
In any event, you won't get others to identify your problems with script
alone. They need to see the mark-up and the CSS to attribute genuine
cause and effect relationships. That is, you should create a cut down
test-case page that demonstrates the issue in isolation.
Richard.