Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect if pointer coarse or fine

I read this about interaction media which is explain how css can detect if pointer is touchscreen or not. It's using @media query like

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

but I just wonder how to implementing it using javascript ot JQuery, is it possible?

Thank you, and sorry for my English

like image 538
Ampersanda Avatar asked Feb 08 '17 04:02

Ampersanda


1 Answers

is_fine = matchMedia('(pointer:fine)').matches
is_coarse = matchMedia('(pointer:coarse)').matches

Works in Chrome for me.

like image 129
Inversion Avatar answered Nov 07 '22 11:11

Inversion