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

209
Visualizações
Prevent restarting JS code when linking to anchor

I have a simple navigation menu linking to different parts of my page using an anchor tag like this

        <a href="#section-2">Blabla</a>

The problem is that I have some JS fading the section in when opening the page but it's also triggered each time I click on the anchor. How to prevent this?

I don't want this, I want to execute my JS at page opening and do nothing (except going to the right section of the page) when clicking on anchor tag

The page is not reloading so I don't understand why this is happening.

Is it because of turbolinks ?

document.addEventListener('turbolinks:load', () => {
  fadeoutImg();
  fadeInText();
});

Thanks a lot!

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