If I try to position an element even with the top of another one, it
ends up higher than I want it due to the default height of the body
margin.
So the top of a div element that I want to place my dynamic element on
top of gives an offsetTop of 0, but if I place my element at 0 it shows
on the very top of the page - higher than the static element due to the
margin.
What should I do differently?
Brad Wood - 31 Aug 2005 15:23 GMT
Sorry, it seems my javascript to determine position was incorrect.
FWIW, the code to get position is simply:
function findPosY(obj)
{
var curtop = 0;
while (obj)
{
curtop += obj.offsetTop
obj = obj.offsetParent;
}
return curtop;
}
> If I try to position an element even with the top of another one, it
> ends up higher than I want it due to the default height of the body margin.