Infinite carousel gets stuck when scrolling too fast
I've been working on this draggable/scrollable infinite carousel for a few hours but I ran into an issue. It seems like whenever my if statements hits within
I've attached a screenshot showing the values of
How could I prevent this from happening?
This problem occurs more often when using shift + scrolling (horizontal scrolling)
https://codepen.io/Gulian256/pen/GgRrLeJ
PS This is my first post here, any feedback to make the post/question clearer would be appreciated!
infiniteScroll, and the user scrolls 'too fast', the if statement triggers again before carousel.scrollLeft() has updated, causing the carousel.scrollLeft() to get overwritten. I've attached a screenshot showing the values of
carousel.scrollLeft(), where we can see that it 'teleports' back and forth a couple of times, causing it to get stuck.How could I prevent this from happening?
This problem occurs more often when using shift + scrolling (horizontal scrolling)
https://codepen.io/Gulian256/pen/GgRrLeJ
PS This is my first post here, any feedback to make the post/question clearer would be appreciated!


