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

179
Views
Cómo llegar al principio de la página sin hacer scroll

Este problema me ha preocupado durante mucho tiempo: quiero que la página llegue a la parte superior sin desplazarse.

Intenté esto, pero no funcionó:

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

0

necesitas tanto x-coord como y-coord

Prueba esto

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

0

si su objetivo es evitar el desplazamiento real (la "animación"), 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

por favor, intente una solución simple. Simplemente reemplace su código por esto aquí:

 window.scroll(0, 0);

Saludos, 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!