Skip to content

Instantly share code, notes, and snippets.

@redoPop
Created September 8, 2014 14:15
Show Gist options
  • Save redoPop/9050999cebcd7e50934a to your computer and use it in GitHub Desktop.
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:
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);
@jdev1977
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment