Javascript/jquery Function to detect mousemovement

Hi,

I want to create a function that captures mouse movement over an object.
The idea is for part of a game whereby the user has to move the mouse up and down a certain number of times. So I need to tally this up so that I know when the user has completed.

Any ideas? And also best for performance
Thanks
coolispaulAsked:
Who is Participating?
 
Sar1973Connect With a Mentor Commented:
You could use the onmousemove event, assigning it to the whole body of your page (see http://www.w3schools.com/jsref/event_onmousemove.asp).
0
 
COBOLdinosaurConnect With a Mentor Commented:
just use the mouse over and increment a counter:

onmouseover="cnt++;"

You will need to define cnt globally in your scripting.

Cd&
0
All Courses

From novice to tech pro — start learning today.