-
-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Touch events on splide slider broke smooth scroll #435
Comments
Thanks for providing the details! Libraries like the one you are using have to call smooth-scrollbar/src/utils/event-hub.ts Lines 50 to 57 in f998115
|
After a little debugging I found they even call |
Fixed in v8.7.4. I also created a related discussion in splide: Splidejs/splide#625 |
As we still ignore the default-prevented let damping = 0;
let pointerCount = 0;
container.addEventListener('touchstart', (e) => {
// save damping
if (pointerCount === 0) {
damping = scrollbar.options.damping;
}
pointerCount++;
// more accurate?
// pointerCount += e.changedTouches.length
});
container.addEventListener('touchend', () => {
pointerCount--;
// more accurate?
// pointerCount -= e.changedTouches.length
// restore damping
if (pointerCount === 0) {
scrollbar.options.damping = damping;
}
}); See also: smooth-scrollbar/src/events/touch.ts Lines 18 to 32 in 7e4e188
smooth-scrollbar/src/events/touch.ts Lines 49 to 67 in 7e4e188
|
in my case, after i update to 8.7.4 and manually restoring damping didn't change anything. still had broken behavior. |
@tdaulbaev have you tried saving&restoring |
Yes! |
Yeah, I totally agree. I'm not too fond of using it on mobile devices either 😆 |
Thanks! |
By the way, it seems OK in my demo: https://codesandbox.io/s/splide-smooth-scrollbar-oxmxh?file=/src/index.js |
there was an error in my implementation, now everything works! |
Environment
Current Behavior
While scrolling the page, if the touch event hits at horizontal slider with drag = true, smooth scrolling breaks.
The smooth transition disappears and a small movement of the fingers can cause an instant jump (delta Y) of 1000+ pixels.
Expected Behavior
When smooth scroll hitting dragable elements should not break smooth scrolling.
Steps to Reproduce
I had the same problem with the swiper slider too.
The text was updated successfully, but these errors were encountered: