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

96
Vistas
Prevent tooltip from showing using onTrigger

Situation: I have a div with a Tippy attached to it, and inside the DIV there are highlighted spans with their own tooltips. They all use click as triggers.

Ideal behavior: When I click on a highlight, only the highlight Tippy should show.

Current behavior: Both tooltips show at the same time.

I can catch the click with onTrigger, using event.target. However, return false or instance.hide() do not prevent it from showing. Is there a way I can do that with onTrigger?

tippy(divEl, {
    content: 'Tooltip!',
    allowHTML: true,
    onTrigger(instance, event) {
        if (event.target.className == 'highlight') {
            console.log('It should hide the tooltip!');
            instance.hide();
            return false;
        }
    },
    arrow: true,
    interactive: true,
    trigger: 'click',
    theme: 'light-border',
    zIndex: 9999
  });
}

I got it working with the following trick, but it wouldn't work if I had other DIVs inside the main DIV:

tippy(divEl, { ...,

  onShow(instance) {
    if (divEl.lastChild.nodeName == "DIV") {return false}
  },
});
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