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

307
Vistas
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
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