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

218
Vistas
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 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