Skip to content

Instantly share code, notes, and snippets.

@ricardoriogo
Created May 30, 2016 21:40
Show Gist options
  • Save ricardoriogo/d250d1b80c46872336adb2490b6f7eee to your computer and use it in GitHub Desktop.
Save ricardoriogo/d250d1b80c46872336adb2490b6f7eee to your computer and use it in GitHub Desktop.
(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