Created
July 8, 2017 05:58
-
-
Save benzkji/32a511d22dfe79b5c69bdde47a5bbd85 to your computer and use it in GitHub Desktop.
is-touch?
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
document.addEventListener('touchstart', function addtouchclass(e){ // first time user touches the screen | |
document.documentElement.classList.add('is-touch') // add "can-touch" class to document root using classList API | |
document.removeEventListener('touchstart', addtouchclass, false) // de-register touchstart event | |
}, false) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://www.quora.com/How-do-I-disable-the-hover-CSS-rule-for-iPhone-and-iPad-touch-device-browsers/answer/John-Miller-386
funny that on stackoverflow you almost wont find this solution, which is, at least for me, quite superior to other solutions.