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

172
Views
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
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!