Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

182
Visualizações
instance.show is not a function error when trying to display tippy.js after 5 seconds on pageload

I am using tippyJS to show a text popup on hover but I also want to display this popup after 5 seconds on pageload so I did this:

const instance = tippy('.tooltippy', {
    trigger: 'mouseenter',
    allowHTML: true,
    placement: 'left',
    animation: 'scale-subtle',
    interactive: true,
    content: function (reference) {
        return reference.querySelector('.tooltipcontent');
    }
});

setTimeout(function() {
  instance.show();
}, 5000);

But after 5 seconds I get:

Uncaught TypeError: instance.show is not a function

While my tippyjs works fine.

My html:

<span class="whatsappicon tooltippy" title="Chat met ons!">
  <span class="whaplabel tooltipcontent">Stel je vraag!</span>
  <a href="url" target="_blank">
    <img src="images/custom/whatsapp_online.png" alt="Open Whatsapp">
  </a>
</span>

What can I do to open this tippy after 5 seconds?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Updated my question since I did not see you assigned it directly to an HTMLCollection. Tippy needs to be binded to NodeList or Element type, so we need to get the element first and assign it to it.

This example should work:

const tooltippy = document.getElementById('tooltippy')

const instance = tippy(tooltippy, {
    trigger: 'mouseenter',
    allowHTML: true,
    placement: 'left',
    animation: 'scale-subtle',
    interactive: true,
    content: function (reference) {
        return reference.querySelector('.tooltipcontent');
    }
});

setTimeout(function() {
  instance.show();
}, 5000);
<script src="https://unpkg.com/@popperjs/core@2/dist/umd/popper.min.js"></script>
<script src="https://unpkg.com/tippy.js@6/dist/tippy-bundle.umd.js"></script>

<span class="whatsappicon" id="tooltippy" title="Chat met ons!">
  <span class="whaplabel tooltipcontent">Stel je vraag!</span>
  <a href="url" target="_blank">
    <img src="images/custom/whatsapp_online.png" alt="Open Whatsapp">
  </a>
</span>

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda