locomotivemtl / locomotive-scroll

🛤 Detection of elements in viewport & smooth scrolling with parallax.
https://locomotivemtl.github.io/locomotive-scroll
MIT License
7.88k stars 1.12k forks source link

Scroll event not updating when on mobile/chrome emulator when scrolling horizontally #243

Open KneePham opened 3 years ago

KneePham commented 3 years ago

When scrolling horizontally. scroll.x and scroll.y ouputs 0 when testing on a real mobile device or when using chrome device emulator.


 var scroll = new LocomotiveScroll(
        {
            el: document.querySelector('[data-scroll-container]'),
            //smooth: true,
            direction: 'horizontal',
            gestureDirection: 'horizontal',
            //gestureDirection: 'both',
            // smartphone: {
            //  direction: 'horizontal',
            // //   horizontalGesture : true
            // },
            // tablet: {
            //  //smooth: true,
            // //   breakpoint: isMobileDevice() ? 1024 : 0
            // },
            //getDirection: true,
            lerp:.09
        }
    );

scroll.on('scroll', (obj) => {
  console.log(obj.scroll.x + " " + obj.scroll.y);
}); 
KneePham commented 3 years ago

play with the settings further and added direction, smooth and horizontalgesture. But now the horizontal gesture is slugglish. (vertically works fine.)

smartphone: { direction: 'horizontal', smooth:true, horizontalGesture : true },

Iraklikandelaki commented 3 years ago

Yes, this bug appears in my new projects too. Old versions of Locomotive scroll is fine in that regard.

yepecece commented 3 years ago

Did anyone find a fix for this? Also, is it possible to disable vertical scroll on touch device when using "horizontal" direction? Thanks