Solved

Javascript/jquery Function to detect mousemovement

Posted on 2013-11-08
2
413 Views
Last Modified: 2013-11-28
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
Comment
Question by:coolispaul
2 Comments
 
LVL 53

Assisted Solution

by:COBOLdinosaur
COBOLdinosaur earned 250 total points
ID: 39634938
just use the mouse over and increment a counter:

onmouseover="cnt++;"

You will need to define cnt globally in your scripting.

Cd&
0
 
LVL 9

Accepted Solution

by:
Sar1973 earned 250 total points
ID: 39635764
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
document.write() deleting all existing HTML 5 52
Open iframe using jquery dialog box 13 41
JQuery Syntax... 4 38
I'm a Human captcha checkbox 13 23
Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question