Wednesday, February 16, 2005

Doh! style.top in a scrolling dhtml container element

In IE6 (and probably others), elements nested within a scrolling container (one with overflowY=auto) act as if they're in an absolutely positioned element - ie you need to account for the container when you're setting element.style.top (so you can't - say - just sum all the offsetY's from there to the document root and add/subtract some delta value for a relative-absolute position).

(Every time I (or someone I've worked with) has tried to do something clever in DHTML it's turned round and bit them on the arse. Clearly with the demise of NS4.x things are looking up, but oh-so-slowly. And I'm a DHTML advocate)

Popular Posts