Skip to content

Instantly share code, notes, and snippets.

@khairulhasanmd
Created April 23, 2017 05:38
Show Gist options
  • Save khairulhasanmd/d26d6f9a3f0223e01d416b4a5218e75a to your computer and use it in GitHub Desktop.
Save khairulhasanmd/d26d6f9a3f0223e01d416b4a5218e75a to your computer and use it in GitHub Desktop.
js idle detection
var timeout = null;
$(document).on('mousemove', function() {
if (timeout !== null) {
$(document.body).text('');
clearTimeout(timeout);
}
timeout = setTimeout(function() {
$(document.body).text('Mouse idle for 3 sec');
}, 3000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment