Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

137
Vistas
How to scroll down and display section on the same page?

I'm developing a one-page website, when user clicks a particular button it should be scrolled down to another section on the page.

Can anyone guide me how to do that?

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

I think the CSS property scroll-padding-top is your answer.

about 4 years ago · Juan Pablo Isaza Denunciar

0

You have different options to solve this

The first approach is to use only HTML to scroll to the element with an specific id

html{height:3000px;scroll-behavior: smooth;}
#readmore{position:absolute; top:2000px;}
<a href="#readmore">Scroll down</a>
<h1 id="readmore">
Read More
</h1>

The second approach is to use scrollIntoView method, which scrolls the specified element into the visible area of the browser window.

const element = document.getElementById("readmore");

document.getElementById('btn').addEventListener('click', () => {
  element.scrollIntoView();
})
html{height:3000px;scroll-behavior: smooth;}
#readmore{position:absolute; top:2000px;}
<button id="btn">Scroll down</button>
<h1 id="readmore">
Read More
</h1>

The third approach is to hard code the specific location where I would like to scroll, in this case I set it to 2000px (height)

const element = document.getElementById("readmore");

document.getElementById('btn').addEventListener('click', () => {
    window.scrollTo(0, 2000);
})
html{height:3000px;scroll-behavior: smooth;}
#readmore{position:absolute; top:2000px;}
<button id="btn">Scroll down</button>
<h1 id="readmore">
Read More
</h1>

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda