swiper has wrong direction when clicks on slide

Created on 4 Feb 2019  路  10Comments  路  Source: nolimits4web/swiper

This is a (multiple allowed):

  • [x] bug
  • [ ] enhancement
  • [ ] feature-discussion (RFC)

I have looped swiper gallery, with slideToClickedSlide, when i try tap or click on right from centered slides all is fine, but when i clicks on left from centered slides, some times slider have wrong direction

Expected Behavior

slider swipes to the left slide

Actual Behavior

slider swipes to the right not actual clicked slide

stale

Most helpful comment

Also having this issue, is there any fix/temporary fix to this yet?

All 10 comments

the problem in loopFix if (activeIndex < loopedSlides) {...
in situation when we have real index (for example 0) and actual index is 7 too, and when i tap on real index 4 swiper slides to 11, as i understand swiper should update loop but don't do this

Also having this issue, is there any fix/temporary fix to this yet?

Also having this issue...
Seems to happen randomly.
Any workaround to fix it?

+1

You can see this behaviour on the homepage, for the "Build Complex Touch Galleries" example, but as @migueltrias said, it seems quite random. http://idangero.us/swiper/

The fix that worked for me was setting threshold: 5 or whatever your sweet spot is, it just needed to be greater than 0, which is the default. It seems that if you move the mouse (or your finger I guess) even by 1px at the same time you click, it registers a swipe instead so it goes the other direction. I found this here: https://github.com/nolimits4web/swiper/issues/3167#issuecomment-520947900

@dimidrola I'll take a look at this. I think this is also a bug when using navigation arrows.

So this has to do with the onTouchEnd event when it checks timeDiff > params.longSwipesMs. As @liamsnowdon mentioned, the click is being registered as a short swipe because you're clicking after moving your cursor. This could have to do with how the onTouchMove event is continuously fired whenever your cursor moves.

Best way to fix this is to follow the advice shown at https://github.com/nolimits4web/swiper/issues/3167#issuecomment-520947900
If you're using navigation arrows, I have a pull request which I believe fixes this issue #3237, let me know if you test it out.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This issue has been automatically closed due to inactivity. If this issue is still actual, please, create the new one.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nicolebo picture nicolebo  路  3Comments

callumacrae picture callumacrae  路  3Comments

syedongit picture syedongit  路  3Comments

Joshanity17 picture Joshanity17  路  3Comments

aeblin picture aeblin  路  3Comments