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

174
Vistas
lock vertical scrolling while horizontal scrolling is in progress in carousel

I'm working in a Vue.js app and in one of the pages I have 3 carousels that the user scrolls horizontally, I would like to disable the vertical scroll because right now when the user is scrolling horizontally the layout moves up and down a little bit.

I found a way to disable the vertical scroll (actually all the scrolling functionality) but in order to scroll up or down, the user need to start touching the screen outside the carousel which results in a worst user experience.

this is my current solution:

// Method for handling scroll
const touchMoveHandler = event => {
  if(event.cancelable) event.preventDefault();
}

// Get all the carousels
let carousels = document.querySelectorAll('.v-scroller');

// Handle scrolling
for (const carousel of carousels) {

  // Add event listener on touchstart to remove scrolling functionality
  carousel.addEventListener('touchstart', event => {
    window.addEventListener('touchmove', touchMoveHandler(event), {passive: false});
  });

  // Remove previous event listener on touchend
  carousel.addEventListener('touchend', event => {
    window.removeEventListener('touchmove', touchMoveHandler(event));
  });
}

In websites like twich.tv/netflix there are some carousels which once you started to scroll horizontall you can't scroll vertically. But if you touch the carousel and instead of scrolling horizontally you scroll vertically you can go up or down.

Any ideas on how they implemented this?

Any help would be appreciated, thanks in advance.

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