Forum Moderators: open
I can read the offsetWidth property to get the new size in IE 5 and above, but IE 4 is not reading the new size. Strangely, if I add an alert just before I try to read the new size, IE 4 gets it right. But as soon as I take the alert out - it fails.
It's as if the browser hasn't finished redrawing the div by the time I want to read the offsetWidth. How can I force the browser to finish redawing the element before I read it's properties? (p.s. a full page reload is out of the question).
There are a number of ways you can force an element to re-render (without a reload) - the most effective one I found was to quickly switch the display style of the element in question. That is:
Set the display property to none (element.style.display = 'none') and then return it to block (element.style.display = 'block').
A complete fudge I know but it did force the element to re-render, with the result we wanted. As I say - this worked for us in IE5, who knows if it will with IE4.
If anybody has a real solution to this problem please share it with us!
Josh