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

312
Views
How to make page scrolling horizantally first then scrolling vertically

enter image description here

I would like to create a page with a similar effect like the gif pic posted.

There are two sections of the page, first one is horizontal section, second one is verical section.

when you scrolling the mouse wheel, the page scroll horizontally first. then it scrolls vertically after it reaches the bottom of the horizontal section.

Somehow, I have on idea how should I set the height of the horizontal section and what is the ratio of trasnlate I should apply on the horizontal section, so that the last element in the horizontal section could take entire space of current view when you scroll to a specific height. Then, you can start scroll vertically to the next section.

I tried to replicate it. Here is link of what I have done so far.

Thank you in advance.

https://codepen.io/hongxuli/pen/eYRywRM

let slider = document.querySelector('.slider-inner')
let sliderWidth = slider.getBoundingClientRect().width

document.querySelector(".horizontal").style.height = `${
      sliderWidth * window.innerHeight / window.innerWidth
    }px`

function animate() {
    let y = window.scrollY
    let precent = y/sliderWidth // what this precent should be ? 
    slider.style.transform = `translateX(-${precent*100}%)`
    requestAnimationFrame(animate)
}

animate()
.horizontal{
    position: relative;
    width: 100vw; 
    //height -- what is the relationship of this height and total width of items

}

.slider-container{
    position: sticky;
    top: 0;
    width: 100vw;
    overflow: hidden;
}

.slider-inner{
    display: flex;
    width: 200vw;
}


.item{
    position: relative;
    width: 100vw;
    height: 100vh ;
    background-color: red;
    border: solid 1px black;
}


.vertical{
    width: 100vw;
    height: 100vh;
    background-color: aqua;
}
<div class="horizontal">
  <div class="slider-container">
    <div class="slider-inner">
      <div class="item"></div>
      <div class="item"></div>
    </div>
  </div>
</div>


<div class="vertical"></div>

about 4 years ago · Juan Pablo Isaza
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!