Created
October 8, 2013 09:32
-
-
Save phalkunz/6882118 to your computer and use it in GitHub Desktop.
Touch event detection
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
// Source: https://hacks.mozilla.org/2013/04/detecting-touch-its-the-why-not-the-how/ | |
if ( | |
('ontouchstart' in window) || | |
(navigator.maxTouchPoints > 0) || | |
(navigator.msMaxTouchPoints > 0) | |
) { | |
/* browser with either Touch Events of Pointer Events | |
running on touch-capable device */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment