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

270
Views
scrollTo and scroll-behaviour: smooth canceling eachother

I have a link to an element within the page on my navbar. I'm trying to get the link to center itself in the navbar using js's element.scrollTo() with smooth behavior.

I'm using css's scroll-behavior: smoth; to animate the scroll to a specific element when my user clicks the anchor.

Using element.scrollTo() interferes with the link click itself as, the link only works if there is no scrolling happening in the navbar. Is there a solution that doesn't involve animating one of the scrolls myself?

about 4 years ago · Santiago Gelvez
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!