Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

208
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!