Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

144
Visualizações
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 Respostas
Responde à pergunta

0

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

about 4 years ago · Juan Pablo Isaza Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda