How to determine if a pointer is rough or accurate

I read this about interacting environments that explain how css can detect if a pointer is touch sensitive or not. It uses a query @medialike

@media (pointer: coarse){
  body{
    // do something
  }
}

but I'm just wondering how to implement it using javascript from jQuery, is this possible?

Thank you and sorry for my english

+4
source share
1 answer
is_fine = matchMedia('(pointer:fine)').matches
is_coarse = matchMedia('(pointer:coarse)').matches

Works in Chrome for me.

+1
source

Source: https://habr.com/ru/post/1669106/


All Articles