Skip to content

Instantly share code, notes, and snippets.

@mattbontrager
Last active June 9, 2017 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattbontrager/5217861 to your computer and use it in GitHub Desktop.
Save mattbontrager/5217861 to your computer and use it in GitHub Desktop.
Detect presence of touch events and handle accordingly (keeping for later development).
var hasTouch = 'ontouchstart' in document.documentElement,
touchStart = hasTouch ? 'touchstart': 'mousedown',
touchMove = hasTouch ? 'touchmove': 'mousemove',
touchEnd = hasTouch ? 'touchend': 'mouseup';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment