better-scroll icon indicating copy to clipboard operation
better-scroll copied to clipboard

How can BetterScroll disable scrolling without affecting click events when click is enabled?

Open lzg2486 opened this issue 1 year ago • 3 comments

lzg2486 avatar Nov 06 '24 06:11 lzg2486

I currently use disable() and enable() to control the turning off and on of better scroll scrolling, but when disable() is used to turn it off, the corresponding click event will also become invalid. The expected effect is that better scroll scrolling can be manually controlled to turn on and off, regardless of whether it is turned on or off, without affecting its click events

lzg2486 avatar Nov 06 '24 06:11 lzg2486

so am i, did you have any help?

shimangdian avatar Dec 09 '24 06:12 shimangdian

Cannot be turned off using the disable() method, otherwise all functions of BetterScroll will be turned off. Instead, an intermediate state is used to manage 'isMaxHeightReached'. When the scrolling height reaches a certain height, the scrolling is paused through scrollTo (0,0,0) and stop(), and the value of 'isMaxHeightReached' is changed to manage scrolling and pausing scrolling through this intermediate value. You can give it a try.

lzg2486 avatar Dec 09 '24 07:12 lzg2486