Hello!
I'm trying to position a javascript tool-tip based on the position of a button. I found this code online for finding the y-offset of the button:
This works great until the user scrolls the broswer window down. Then the position is incorrect, and my tooltip ends up waaaay down the page instead of adjacent to the button.
Any ideas?
Thanks!
- Bret
I'm trying to position a javascript tool-tip based on the position of a button. I found this code online for finding the y-offset of the button:
Code:
function findPosY(obj)
{
var curtop = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curtop += obj.offsetTop
obj = obj.offsetParent;
}
}
else if (obj.y)
curtop += obj.y;
return curtop;
}
This works great until the user scrolls the broswer window down. Then the position is incorrect, and my tooltip ends up waaaay down the page instead of adjacent to the button.
Any ideas?
Thanks!
- Bret