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

197
Views
I have the scroll behavior set to smooth in CSS but how to write it in JS?

I've set the scroll functionality to smooth using CSS

scroll-behavior: smooth

I've been told it can be done using scrollIntoView or scrollTo, but I am a bit beginner to this. How do I turn that to pure JS?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

scroll-behavior CSS property make the contents within an element scroll smoothly. While Element.scrollIntoView is used to programmatically scroll to an element.

If you want for example scroll to the header of the page with scroll-behavior: smooth you can opt-in the behavior option and set it to smooth.

var header = document.getElementById("header")
header.scrollIntoView({ behavior: "smooth" })
about 4 years ago · Juan Pablo Isaza Report
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!