Created
September 8, 2014 14:15
-
-
Save redoPop/9050999cebcd7e50934a 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 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
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
Chrome team has seen the light on Pointer API https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/ODWmcKNQl0I Safari and Firefox still dragging their feet