-
-
Save alxpsr/eff00827d88b9e1bc817f9b132962a59 to your computer and use it in GitHub Desktop.
IE10 & IE11 don't trigger touch events (e.g., touchstart). If you want to differentiate touches from clicks, you must use the pointer events API and the event object's pointerType property:
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 onPointerDownHandler (event) { | |
if (event.pointerType === 'touch') { | |
// Equivalent to a touchstart on MS Surface | |
} | |
} | |
// For IE 10 | |
element.addEventListener('MSPointerDown', onPointerDownHandler); | |
// For IE 11+ | |
element.addEventListener('pointerdown', onPointerDownHandler); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment