better-scroll
better-scroll copied to clipboard
How can BetterScroll disable scrolling without affecting click events when click is enabled?
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
so am i, did you have any help?
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.