Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.63 KB | None | 0 0
  1. $(document).ready(function () {
  2.         var idleState = false;
  3.         var idleTimer = null;
  4.         $('*').bind('mousemove click mouseup mousedown keydown keypress keyup submit change mouseenter scroll resize dblclick', function () {
  5.             clearTimeout(idleTimer);
  6.             if (idleState == true) {
  7.                 $("body").css('background-color','#fff');            
  8.             }
  9.             idleState = false;
  10.             idleTimer = setTimeout(function () {
  11.                 $("body").css('background-color','#000');
  12.                 idleState = true; }, 2000);
  13.         });
  14.         $("body").trigger("mousemove");
  15.     });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement