Skip to content

Instantly share code, notes, and snippets.

@droid001
Created September 2, 2020 08:28
Show Gist options
  • Save droid001/4a0d740e31274f065f3b622f513e2355 to your computer and use it in GitHub Desktop.
Save droid001/4a0d740e31274f065f3b622f513e2355 to your computer and use it in GitHub Desktop.
Tests the user agent for the existance of a pointer. Used to tect mobile deveices.
// Derived from https://stackoverflow.com/a/52854585/7197027
export const hasPointer = ()=>window.matchMedia("(any-hover: none)").matches === false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment