How to get x and y Position

Any problem with javascript can be discussed here.
Post Reply
Gebbo
Posts: 554
Joined: Tue May 16, 2006 3:22 pm

How to get x and y Position

Post 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


.............................:: Spirit of Fire ::..................................

Image
Freedom Fighter
Posts: 479
Joined: Tue May 16, 2006 11:53 am

Post 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!
Gebbo
Posts: 554
Joined: Tue May 16, 2006 3:22 pm

Popup

Post 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.
.............................:: Spirit of Fire ::..................................

Image
mnop927
Posts: 2
Joined: Mon Jan 10, 2011 7:03 am

新加的空白文章15

Post by mnop927 »

这是新加的空白文章15,可以在UBB可视化编辑器中,添加和修改文章内容。
nyasro
Posts: 14
Joined: Sat Jun 09, 2012 11:15 am

Post 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
};
};
Post Reply