Scrollbar jumps in IE pop up windows

20090426751

I don’t end up using new window spawning pop up code very often anymore. UI practices have mostly moved beyond it or gone the way of modal elements instead. When I do need to code a pop up, if anything doesn’t work quite perfect I assume it must be something I did wrong with the code. Not always so.

I recently had a pop window that contained text rendered with sIFR. In Internet Explorer (6/7/8), the scrollbar of the pop up window would always jump back to the top as soon as released. Keeping it scrolled to the bottom was impossible. Using dummy content, the scroll distance was only 80 pixels or so. Resizing the window by dragging the corner corrected the scrollbar issue. Open the url in a normal window and the issue never presented itself. Same case if no dimensions were set on the pop up.

When sIFR initializes, there is a brief moment when the replaced tag contains no value and has a computed height of 0 if no explicit value is set. Internet Explorer seemed to be computing the available scroll height in that instant resulting in it, for example, thinking there is only 400px of content and no need to scroll when once the sIFR text renders there is 480px of content and an available scroll height of 80px. The scroll bar corrects itself allowing for the bar to move, but the jumps back the missing pixels due to miscalculating the distance.

Solution: set an explicit height/min-height on the element being replaced by sIFR. This forces the browser to always know the actual height of the content.

Comments

  1. sally 20090427

    i lost interest not even halfway


Skateboards and bikes are better at nights

Skateboards and bikes are better at nights. 0 comments.


Search WayTooCrowded
The Header Should Always Point Home