9

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

Blackbam
  • 14,898
  • 22
  • 85
  • 134
Ampersanda
  • 1,780
  • 1
  • 18
  • 33

1 Answers1

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

Works in Chrome for me.

Inversion
  • 1,005
  • 13
  • 19