Created
          April 23, 2017 05:38 
        
      - 
      
- 
        Save khairulhasanmd/d26d6f9a3f0223e01d416b4a5218e75a to your computer and use it in GitHub Desktop. 
    js idle detection 
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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