Page 1 of 1

How to get x and y Position

Posted: Wed Jul 28, 2010 12:19 am
by Gebbo
Hello

How do you get the x and y positions of something you have hovered your mouse over using javascript ? I am trying to make a popup, so when you hover over text, it creates a popup Window.

Thanks

Posted: Fri Jul 30, 2010 7:14 am
by Freedom Fighter

Im sorry I looked around and I cant really find a good resource.
and i do not know either.

This is an interesting idea, it seems to have endless options haha.
good luck.
and thank you for posting a real post!

Popup

Posted: Fri Jul 30, 2010 2:39 pm
by Gebbo
You know me, I am always posting real posts on these forums ;]! (Y) also I found what i needed, on http://www.devarticles.com/c/a/JavaScri ... -Part-I/1/ for future reference or if anyone stumbles upon this and needs to figure out how to do it.

新加的空白文章15

Posted: Sat Apr 16, 2011 6:36 am
by mnop927
这是新加的空白文章15,可以在UBB可视化编辑器中,添加和修改文章内容。

Posted: Mon Jun 11, 2012 2:01 pm
by nyasro
i found your answer in stackoverflow[.]com[/questions/160144/find-x-y-of-an-html-element-with-javascript] which is as follows
var **** = function (obj) {
var left, top;
left = top = 0;
if (obj.offsetParent) {
do {
left += obj.offsetLeft;
top += obj.offsetTop;
} while (obj = obj.offsetParent);
}
return {
x : left,
y : top
};
};