dynamicweb / swiffy-slider

Super fast carousel and slider with touch for optimized websites running in modern browsers.
MIT License
238 stars 29 forks source link

Incorrect dragging behavior #48

Closed katriellucas closed 1 year ago

katriellucas commented 1 year ago

Describe the bug Incorrect behavior when dragging slider on its first and last slide, of course this only happens if you are using the extended version of the lib.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'https://swiffyslider.com/configuration/?slider-nav-mousedrag=slider-nav-mousedrag'
  2. On the first image, drag the slider from left to right.
  3. You will briefly see the second image on the slider, like we were dragging it from right to left, the reverse also happens if we are on the last image of the slider

Expected behavior Either nothing or the slingshot effect, where you try to drag the slider, but as you release, it returns to its original position.

Screenshots Recording 2022-07-27 at 00 34 27

Desktop

nicped commented 1 year ago

Good catch. Seems to happen when you drag longer than 1.8x the slide width on first or last slide. So a situation that was not handled by the script.

I have made a small change to take this into consideration.

nicped commented 1 year ago

You can test on the examples page - remember to clear your browser cache. Still needs to be released to NPM - waiting for a verification.