Home > Back-end >  Scroll page by 100vh (including mobile/safari nav elements) on click
Scroll page by 100vh (including mobile/safari nav elements) on click

Time:01-11

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. 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).

CodePudding user response:

Try this code

function scrollYByVh() {
  const clientHeight = document.body.clientHeight;
  window.scrollBy(0, clientHeight);
}
  •  Tags:  
  • Related