You can't do precisely what you want by listening to window resize
events.
Check out Google maps or reader, try resizing the window vertically. Note that these apps exhibit the same behavior.
Look a bit more carefully at your CSS. I find that sometimes CSS can do some very surprising things. If you post some sample HTML and CSS that is representative of you problem, we may be able to devise a solution.
If you absolutely cannot tolerate waiting until the user has finished resizing the window, you could poll document.scrollWidth
and document.scrollHeight
at a short interval. Whenever they change, call your resizing code. Note that polling these properties may be pretty expensive. I recommend against this, but it will solve the problem.
If you are using Internet Explorer, depending on version, you made need to use document.documentElement.scrollWidth
or document.body.scrollWidth
(and similar for scrollWidth
).
Firefox 3.6 will support events for determining when document.scrollWidth
and document.scrollHeight
change, although it looks like it will be non-standard:
https://developer.mozilla.org/en/DOM/Detecting_document_width_and_height_changes