I was using a function setPos (usage obj.setPos() listed ( at bottom of
post ) to calculate the absolute position of an element.
However, when calculating a div with a set height, and styled with css
overflow: auto;, I get the position where it would be if I was at the
top of the div.
This was a problem, so I added a bit to adjust for the scrolling. (
This works in IE6. )
I read Bug 62536 but I can't tell what's been implemented or not,
Goodman in DHTML(v2) says the scrollTop is implemented for divs still NS7.
Souldn't this script work once the comment is removed (even though it
doesn't in moz1.3b)?
Does Moz support scrollTop?
Is it just me?
function absPos() {
var x = (this.offsetLeft) ? this.offsetLeft : 0;
var y = this.offsetTop;
var parentObj = this.offsetParent;
while ( parentObj ) {
x += parentObj.offsetLeft;
y += parentObj.offsetTop; // - parseInt( ( parentObj.scrollTop ) ?
parentObj.scrollTop : 0, 10 );
parentObj = parentObj.offsetParent;
}
this.absOffsetLeft = x;
this.absOffsetTop = y;
}
