1 pixel variation in screen positions

N

Nodlehs

I am using this function to determine the absolute vertical location of
an element in my pages.

function getYPos(element)
{
var yPos = 0;
var elementIterator = element;

while (elementIterator)
{
yPos += elementIterator.offsetTop
elementIterator = elementIterator.offsetParent;
}
return yPos;
}

Now, when I call this, in FF(1.5.0.6) I get a pixel above the element I
pass.
In another machine, FF(1.5.0.1) I get the top most pixel of the element
I pass.
In IE 6 I get the top most pixel of the element I pass.

Can anyone explain to me why I possibly get different values on
different browsers? I have tried it on multiple machines with
FF(1.5.0.6) and get the same result. Any help would be much
appreciated.

Thanks,
Ken.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top