[Vuejs]-How can I turn this "wheel" event for touch and/or drag?

0👍

Abstracted your example into vanilla js as your issue looks unrelated to nuxt/vue. Here’s a reduced example: https://codepen.io/team/hato/pen/QWVdMaK

Carousel logic seems working when you scroll/wheel on top of it as expected.

Hadn’t tested on touch/mobile; was aiming to check if "resets to the starting position" occurred. I couldn’t experience any glitch/resets so far. Only slowness is mainly down to the use of gsap to animate it, where the easing could create a sense of delay.

Added preventDefault to avoid window scrolling when user is interacting:

let handleScrollEvent = (e) => {
  
    e.preventDefault(); // added preventDefault to avoid window scrolling

    // rest of code ...

}

Leave a comment