Skip to content


Subversion checkout URL

You can clone with
Download ZIP
provides you a way to monitor user activity with a page.
branch: master

This branch is 5 commits ahead, 78 commits behind thorst:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


jQuery Idle Timer Plugin


Fires a custom event when the user is idle. 

Idle is defined by not...
* moving the mouse
* scrolling the mouse wheel
* using the keyboard

Basic idea is presented here:

To use:

// idleTimer() takes an optional argument that defines the idle timeout
// timeout is in milliseconds; defaults to 30000
$(document).bind("idle.idleTimer", function(){
 // function you want to fire when the user goes idle

$(document).bind("active.idleTimer", function(){
 // function you want to fire when the user becomes active again

// pass the string 'destroy' to stop the timer

// you can also query if it's idle or not
$.data(document,'idleTimer');  // 'idle'  or 'active'

// get time elapsed since user when idle/active
$.idleTimer('getElapsedTime'); // time since state change in ms

// API available in >= v0.9

// bind to specific elements, allows for multiple timer instances
$.data(elem,'idleTimer');  // 'idle'  or 'active'

// if you're using the old $.idleTimer api, you should not do $(document).idleTimer(...)

// element bound timers will only watch for events inside of them.
// you may just want page-level activity, in which case you may set up
//   your timers on document, document.documentElement, and document.body

Something went wrong with that request. Please try again.