Skip to content
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

cssMode: true + loop: true + autoplay result in autoplay being skipped in odd even pattern #6919

Closed
5 of 6 tasks
mmis1000 opened this issue Aug 10, 2023 · 0 comments · May be fixed by abhishekbedi/framework7#1, Aarod23/nys-site#1 or wierza/Team-project#148

Comments

@mmis1000
Copy link

mmis1000 commented Aug 10, 2023

Check that this is really a bug

  • I confirm

Reproduction link

https://codesandbox.io/p/sandbox/swiper-infinite-loop-forked-qw3n85?file=%2Findex.html%3A87%2C20

Bug description

  1. Make a swiper that use all options above with 3 slide.
  2. Attach a slideChange handler with time and realIndex logged.
  3. Wait for the autoplay to play the third slide
  4. start to observe the console output

Expected Behavior

The console output like

0 seconds, slide 0
6 seconds, slide 1
12 seconds, slide 2
18 seconds, slide 0
24 seconds, slide 1
30 seconds, slide 2

Actual Behavior

The console output like

0 seconds, slide 0
6 seconds, slide 0
12 seconds, slide 1
18 seconds, slide 1
24 seconds, slide 2
30 seconds, slide 2

The slide only change one in two times.

Swiper version

11.2.0

Platform/Target and Browser Versions

windows edge

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
  • Make sure this is a Swiper issue and not a framework-specific issue

Would you like to open a PR for this bug?

  • I'm willing to open a PR

Note

it seems cause by early return here

return true;

The loopFix.js calls slideTo to fix slide position.
And slideTo is supposed to fix the translate of swiper

swiper.setTransition(speed);
swiper.setTranslate(translate);

But due to the early return in cssMode, these lines are completely skipped.

Hence the slideTo choke at the next time called by autoPlay .js at

if ((rtl && -translate === swiper.translate) || (!rtl && translate === swiper.translate)) {

due to incorrect swiper.translate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant