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

176
Views
Scrolling without animation JavaScript

I want to do a sharp upward scrolling.

window.scrollTo(0, 0)

scrolls smoothly, how do I scroll up without animation?

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

0

You can use document.documentElement.scrollTop = 0; for Chrome, Firefox, IE, Opera and Edge Browsers and document.body.scrollTop = 0 for Safari Browser

about 4 years ago · Juan Pablo Isaza Report

0

You pass an object instead of position, like this:

element.scrollTo({
  top: 0,
  left: 0,
  behavior: 'instant'
});

behavior is default selected by browser, in chrome it uses smooth, where en webkit browser, default is instant.

https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTo

about 4 years ago · Juan Pablo Isaza Report

0

scroll-behavior: smooth;

You can use this for smoothly.

if you don't want to be smoothly, use this:

scroll-behavior: auto;
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!