0

Based on this documentation: https://developer.mozilla.org/en-US/docs/Web/CSS/@media/pointer

You should be able to programmatically react differently to different available pointer types using CSS. However, I felt like there used to be an easy way to test what pointer your current device was using but from looking around on Stackoverflow all over the place I can no longer find it. How can I achieve this and find out the current pointer value for my device?

Adam Marshall
  • 6,369
  • 1
  • 29
  • 45
Anthony
  • 13,434
  • 14
  • 60
  • 80
  • This might be useful: https://stackoverflow.com/questions/38762367/how-to-use-javascript-get-current-cursor-style-from-browser – srWebDev Sep 09 '21 at 13:04

1 Answers1

1

Finally tracked it down

is_fine = matchMedia('(pointer:fine)').matches
is_coarse = matchMedia('(pointer:coarse)').matches
console.log(`is fine: ${is_fine}, is_coarse: ${is_coarse}`)

From: How to detect if pointer coarse or fine

Can add that you can do this for hover as:

can_hover = matchMedia('(hover)').matches
no_hover = matchMedia('(hover:none)').matches
console.log(`can hover: ${can_hover}, no hover: ${no_hover}`)
Anthony
  • 13,434
  • 14
  • 60
  • 80