/    Sign up×
Community /Pin to ProfileBookmark

mouse movements and idle time

Hello All,

I’m basically trying to record idle time on a web page through mouse events. If the mouse stops moving a timer would start and then say at 10 minutes of no mouse movement or idle time a redirect or function would kick off. If the mouse moves again then the timer starts over, etc.

A spent some time with the onmousemove event which seems to be the ticket but have nothing to show for it and can’t seem to connect the dots.

Does anyone have any ideas on this?

Any help would be greatly appreciated. Thanks.

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@Big_O_1_Feb 23.2011 — you could use the mousemove event. Every time the event is fired, reset the timer to 0. Otherwise, let the timer run and when it hits a certain time fire off that function.

Or you can constantly get the mouse position and if it has changed, reset the timer. If it hasn't for a while fire off that function.
Copy linkTweet thisAlerts:
@apace626authorFeb 23.2011 — Thanks for the reply,

Yes, that's exactly what I want to do but I'm looking for help with the actual JS code.
Copy linkTweet thisAlerts:
@Big_O_1_Feb 23.2011 — I haven't done this myself, but here is a thread I found:

http://stackoverflow.com/questions/667555/detecting-idle-time-in-javascript-elegantly
Copy linkTweet thisAlerts:
@apace626authorFeb 23.2011 — I'll take a look, thanks for helping out!
×

Success!

Help @apace626 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...