Created
May 30, 2016 21:40
-
-
Save ricardoriogo/d250d1b80c46872336adb2490b6f7eee to your computer and use it in GitHub Desktop.
This file contains 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
(function(){ | |
var timeout; | |
var isHidden = false; | |
document.addEventListener("mousemove", function() { | |
if (timeout) { | |
clearTimeout(timeout); | |
} | |
timeout = setTimeout(function() { | |
if (!isHidden) { | |
//document.querySelector("body").style.cursor = "none"; | |
document.documentElement.classList.add('hiddenMouse'); | |
isHidden = true; | |
} | |
}, 1500); | |
if (isHidden) { | |
//document.querySelector("body").style.cursor = "auto"; | |
document.documentElement.classList.remove('hiddenMouse'); | |
isHidden = false; | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment