Skip to content

Instantly share code, notes, and snippets.

@jaygidwitz
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaygidwitz/b652fce81c509b98c73f to your computer and use it in GitHub Desktop.
Save jaygidwitz/b652fce81c509b98c73f to your computer and use it in GitHub Desktop.
idleTimer = null;
idleState = false;
idleWait = 2000;
(function ($) {
$(document).ready(function () {
$('*').bind('mousemove keydown scroll', function () {
clearTimeout(idleTimer);
if (idleState == true) {
// Reactivated event
$("body").append("<p>Welcome Back.</p>");
}
idleState = false;
idleTimer = setTimeout(function () {
// Idle Event
$(document).scrollTo('#jump');
idleState = true; }, idleWait);
});
$("body").trigger("mousemove");
});
}) (jQuery)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment