Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

201
Vistas
Is there a way to detect hover mechanism (or trackpad/mourse)?

I currently have @media (any-hover: hover) condition in my css, and previously with (hover: hover), but neither do what I want: I would like to only enable hover event if a mobile device have some kind of hover mechanism (eg. trackpad, mouse but not limited) implanted.
However, with hover:hover at least on iPad it doesn't stimulate the hover event at all (I know hover detects if the device's primary interaction supports hover), not even I have magic keyboard connected (which has a trackpad). Then I change to any-hover and this time the iPad stimulates hover even without any accessory connected, and is interact with touch.

Hence, is there's a way to detect if a device has hover-able device connected? Should I use pointer: fine or pointer: coarse to do this? Or is there a way to do so in JS? I don't want it simply detect if there's a mouse connected, but any kind of device with hover-like mechanism.

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

So you want something that does not match for normal iPads and does match if someone plugs a mouse into an iPad?

pointer: fine is usually enough, but you can get even more precise with (any-hover: hover) and (pointer: fine). You really only want to enable hover content for devices that have fine-grained pointer control.

You can express this in JS as well:

let mql = window.matchMedia('(any-hover: hover) and (pointer: fine');

Then I change to any-hover and this time the iPad stimulates hover even without any accessory connected, and is interact with touch.

That seems like a bug.

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda