Forum Moderators: open

Message Too Old, No Replies

This should be a challenge

Here's a challenge regarding mouse movement

         

adni18

7:56 pm on Sep 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is there a way (in javascript) to tell which direction the user has moved his or her mouse?

DrDoc

8:05 pm on Sep 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can constantly check the x/y coordinates, always storing the previous value for comparison. Then, by comparing the current coordiates with previous, you'd be able to determine whether the mouse was moved up/down/left/right

adni18

9:13 pm on Sep 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This method happens to be a very cpu-intensive process for some users.

DrDoc

9:25 pm on Sep 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



True... never said it wasn't ;)
But it works...

I'm afraid I don't know of another way.