baptistebriel / smooth-scrolling

smooth scrolling and parallax effects on scroll
MIT License
612 stars 75 forks source link

What about mobile ? #80

Closed woowski closed 6 years ago

woowski commented 6 years ago

Hey baptiste !

I'm wondering about those options of VS.

touchMultiplier : I suppose it is used to crank up or slow down the amount of scrolling on touch devices but i can't find any differences even if i boost the value to unreasonnable amounts.

preventTouch : I suppose it is used to prevent the smooth scrolling to run on touch devices, but once again, it doesn't appear to make any differences.

Am i wrong about what those two options are supposed to do ? I suppose i'm not as i read in a other issue that's what they're suppose to do.

And i suppose i've passed the options the right way, but again, i might be wrong.

const smooth = new Smooth({
            listener: uscroll,
            native: true,
            section: section,
            ease: 0.05,
            vs: {
                 touchMultiplier: 1.5,
        preventTouch: false,
         }
})

Merci !

baptistebriel commented 6 years ago

Hello @woowski,

The reason why you don't see any effect after adding theses options is because you're using the default browser scrollbar (with native: true). If you switch to false, if will use virtual-scroll instead of the default scroll behavior.

You can have a look at the VirtualScroll dependency, where theses options come from. https://github.com/ayamflow/virtual-scroll

touchMultiplier: Mutiply the touch action by this modifier to make scroll faster than finger movement. preventTouch: If true, automatically call e.preventDefault on touchMove. Defaults to false.

Cheers!

woowski commented 6 years ago

thanks for the explanation. That's what i thought.