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

170
Vistas
How to allow a click in a mouseenter/mouseleave hover div without closing it?

I have a "more details" pane that opens up when a user either hovers a mouse over a tooltip, or clicks the tooltip with a touchscreen. This is simply achieved via

tooltip.addEventListener('mouseenter', showPane);

I was surprised how easy this was, with mouseenter seeming to work perfectly for mouse hover or touchscreen tap.

At the moment it's closed with

tooltip.addEventListener('mouseleave', hidePane);
tooltip.addEventListener('click', hidePane);

I.e. any screen tap or mouse click, or mousing away (if user has a mouse) from the tooltip icon will close the pane.

This may be an XY problem. What I want is to have a prompt for the user to access MORE more details. So in the "more details" popup pane, I have a line "press [1] to see more" (1 styled like a keyboard key). Unless they have a touchscreen, and a small enough screen, in which case I assume they have no physical keyboard/mouse and ask them to "Click here to see more" instead.

(I know this isn't perfect, but I can't think of a better way to achieve it. I could make mouse users have to click the tooltip instead, so the experience was the same for mobile/PC/whatever, styling it with a pointer cursor, but I prefer it to work on hover.)

It all works perfectly, except for the "click here to see more" link, which just closes the tooltip instead. I don't know how to exclude those clicks from both of the hidePane event handlers. Any help appreciated, thank you!

about 4 years ago · Juan Pablo Isaza
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