Created
April 28, 2018 14:29
-
-
Save marcandrewb/a330e87f07f70c2e898573549cf89e52 to your computer and use it in GitHub Desktop.
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
// `ontouchstart` check works on most browsers | |
// `maxTouchPoints` works on IE10/11 and Surface | |
export function isTouchDevice() { | |
if (!window) return false; | |
return 'ontouchstart' in window || navigator.maxTouchPoints; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment