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

203
Visualizações
Scroll page by 100vh (including mobile/safari nav elements) on click

For one of our clients we have made a click-through portfolio. By disabling the scroll on the page and instantly moving the page 100vh down on click – we create the illusion that we see a new page, without actually loading it. It works great on desktop. See it here. Here is the javascript used to achieve it:

<!-- Click area and on-click action -->  
<div class="click-next" onclick="scrollWin(0, window.innerHeight)"></div>
<div class="click-back" onclick="scrollWin(0, window.innerHeight / -1)"></div>


<script>

// Scroll function
function scrollWin(x, y) {
  window.scrollBy(x, y);
}

</script>

On mobile however, I'm running into a problem. When first entering the page, the safari search-bar is visible. When clicking through, the page will scroll down the full height excluding the height of the search bar and offsetting the whole thing:

enter image description here

How do I make sure that the script scrolls by 100vh, ignoring native mobile browser elements? (I am not Javascript guru by any means. The site it made in Webflow).

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Try this code

function scrollYByVh() {
  const clientHeight = document.body.clientHeight;
  window.scrollBy(0, clientHeight);
}
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