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

Dynamic main bullets are not centered when loop #5304

Closed
6 tasks done
fmatzy opened this issue Dec 20, 2021 · 1 comment
Closed
6 tasks done

Dynamic main bullets are not centered when loop #5304

fmatzy opened this issue Dec 20, 2021 · 1 comment

Comments

@fmatzy
Copy link

fmatzy commented Dec 20, 2021

Check that this is really a bug

  • I confirm

Reproduction link

https://codesandbox.io/s/swiper-pagination-dynamic-forked-teq17

Bug description

When dynamicBullets: true and loop: true are set, and dynamicMainBullets is set to a value greater than 1, the main bullets are not centered and move strangely. This is especially obvious when moving the page in the backwards direction.

I investigated the pagination module, and I found that the index shift caused by swiper.loopedSlides is not considered when calculating the dynamicBulletIndex.

dynamicBulletIndex += current - swiper.previousIndex;

Expected Behavior

When loop: false, the main bullets will always be in the middle, and the same looks would be preferable when loop: true.

dynamic-bullets-without-loop

Actual Behavior

In the case of forward pagination, the main bullets will shift to the left at the end of the pagination.

invalid-main-bullets-forward

In the case of backward pagination, strange movements like going forward and backward can be seen.

invalid-main-bullets-backward

Swiper version

7.3.3

Platform/Target and Browser Versions

macOS 11.6.1, Chrome 96.0.4664.110

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants