Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 443
  • Last Modified:

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
0
coolispaul
Asked:
coolispaul
2 Solutions
 
COBOLdinosaurCommented:
just use the mouse over and increment a counter:

onmouseover="cnt++;"

You will need to define cnt globally in your scripting.

Cd&
0
 
Sar1973Commented:
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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now