dom_extensions.js defines the following functions:
getOffsetLeft()getOffsetLeft(element, deep)
elementReference to an HTML element.
deepAn optional boolean to indicate whether to get the offset from the document root as opposed to the offset parent; true uses the document root, false uses the offset parent. Defaults to false.
The horizontal distance to the element from either the document root or the element's offset parent in pixels.
getOffsetLeft() gets the element's offset from either it's offset parent (which behaves like element.offsetLeft) or the document root (which avoids browser-specific offset parent issues). The document root option is by far the more useful. Note that on IE Mac, the document's padding is not accounted for.
getOffsetTop()getOffsetTop(element, deep)
elementReference to an HTML element.
deepAn optional boolean to indicate whether to get the offset from the document root as opposed to the offset parent; true uses the document root, false uses the offset parent. Defaults to false.
The vertical distance to the element from either the document root or the element's offset parent in pixels.
getOffsetTop() gets the element's offset from either it's offset parent (which behaves like element.offsetTop) or the document root (which avoids browser-specific offset parent issues). The document root option is by far the more useful. Note that on IE Mac, the document's padding is not accounted for.
This script is released under a Creative Commons License.