barthy-koeln / scroll-snap-slider

Mostly CSS slider with great performance.
https://barthy-koeln.github.io/scroll-snap-slider/
MIT License
128 stars 6 forks source link

fix(draggable): cancel stop-listener when started dragging again #24

Closed barthy-koeln closed 7 months ago

barthy-koeln commented 7 months ago

Steps to replicate:

-> The slider jumps to the start or end of the slide

Bug Found

When releasing the drag, an event listener is added for the slide-stop event, that is delayed by a few hundred milliseconds.

This event listener resets styles enabled for the dragging. When starting the drag between releasing the pointer and the execution of the listener, the bug occurs.

Solution

Remove the event listener when starting a new drag.