www.webdeveloper.com
Results 1 to 5 of 5

Thread: mouse movements and idle time

  1. #1
    Join Date
    Feb 2011
    Posts
    3

    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.

  2. #2
    Join Date
    Nov 2010
    Location
    Los Angeles, CA
    Posts
    234
    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.

  3. #3
    Join Date
    Feb 2011
    Posts
    3
    Thanks for the reply,

    Yes, that's exactly what I want to do but I'm looking for help with the actual JS code.

  4. #4
    Join Date
    Nov 2010
    Location
    Los Angeles, CA
    Posts
    234
    I haven't done this myself, but here is a thread I found:

    http://stackoverflow.com/questions/6...ript-elegantly

  5. #5
    Join Date
    Feb 2011
    Posts
    3
    I'll take a look, thanks for helping out!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles