related to browser window's upper left corner of client area.
That's the right idea, but I believe there are some browser inconsistencies in the way `element.offsetParent` and `element.offsetTop`/`element.offsetLeft` is handled. I'd research how the major frameworks the doing this before copy/pasting that code...
Øystein Riiser Gundersen
2009-09-07 14:41:46
Actually quirksmode has been dealing with cross browser compatibility for years but if you can use Jquery (or part of it) take a look at the offset method http://docs.jquery.com/CSS/offset
Ariel Popovsky
2009-09-07 15:25:00
Indeed. The jQuery implementation is pretty hairy: http://code.google.com/p/jqueryjs/source/browse/trunk/jquery/src/offset.js Prototype's `Element.viewportOffset()` may be worth looking at as well http://prototypejs.org/assets/2009/8/31/prototype.js
Øystein Riiser Gundersen
2009-09-07 18:41:37