Skip to content

Instantly share code, notes, and snippets.

@gabrielecanepa
Last active March 11, 2024 14:57
Show Gist options
  • Save gabrielecanepa/4ab9e0f8bb9b8ffe7d6652a5692848b5 to your computer and use it in GitHub Desktop.
Save gabrielecanepa/4ab9e0f8bb9b8ffe7d6652a5692848b5 to your computer and use it in GitHub Desktop.
JavaScript snippet to check if a device supports touch gestures.
const isTouchDevice = () => !!('ontouchstart' in window) || !!('msmaxtouchpoints' in window.navigator)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment