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

174
Views
How to get to the top of page without scrolling

This problem has troubled me for a long time: I want the page to reach the top without scrolling.

I tried this, but it didn’t work:

window.scrollTo({
  top:0,
  behavior: 'auto'
 });
about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

you need both x-coord and y-coord

Try this

window.scrollTo({
  top: 0,
  left: 0,
  behavior: 'smooth'
});
about 4 years ago · Juan Pablo Isaza Report

0

if your aim is to avoid the actual scrolling (the "animation"), use behavior: 'instant'.

const button = document.getElementById('instant-top-button')
button.addEventListener('click', () => window.scrollTo({
  top: 0,
  behavior: 'instant',
}))
<p>scroll down &#11123;</p>
<p>
  <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
</p>
<button id="instant-top-button">&#11121; to top, instantly!</button>

about 4 years ago · Juan Pablo Isaza Report

0

please, try a simple solution. Just replace your code for this here:

window.scroll(0, 0);

Cheers, Marcelo

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!