Connecting Tech Pros Worldwide Help | Site Map

Mouse over

  #1  
Old January 25th, 2007, 04:15 PM
egebamyasi
Guest
 
Posts: n/a
I have been trying to find the mouse coords when I move the pointer
over a div/image/etc... When I try e.clientX, e.clientY I retrieve the
mouse coords relative to the browser window. This is okay but
unfortunately when I scroll down the contents change position while the
coords stay the same. Is there any way around this?

  #2  
Old January 25th, 2007, 05:45 PM
Ivo
Guest
 
Posts: n/a

re: Mouse over


"egebamyasi" <ashley.hales@gmail.comschreef
Quote:
>I have been trying to find the mouse coords when I move the pointer
over a div/image/etc... When I try e.clientX, e.clientY I retrieve the
mouse coords relative to the browser window. This is okay but
unfortunately when I scroll down the contents change position while the
coords stay the same. Is there any way around this?
So measure the amount that has been scrolled and substract that from the
mousepositions as found. It is unfortunate but will come as no big surprise
that browsers report this in different properties. Some use
document.pageXOffset and document.pageYOffset but IE cs. put the numbers in
document.scrollLeft and document.scrollTop. To see if either a number use
the typeof operator instead of just checking the value because the value may
be 0 (zero).
HTH
Ivo
http://4umi.com/web/javascript/mouseposition.htm


Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mouse over Rudiga answers 2 February 27th, 2006 07:25 PM
Mouse Over ToolTip in a tree view Pavan answers 5 December 16th, 2005 03:11 AM
Changing color of hyperlink when mouse over it Martha answers 5 November 16th, 2005 07:04 PM
Using On Mouse Over OR Mouse Move to display a description meganrobertson22@hotmail.com answers 2 November 13th, 2005 07:47 AM
How to Make "Mouse-Over" Drop-Down Menus Larry R Harrison Jr answers 7 July 23rd, 2005 02:09 PM