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

Freemode repeatedly re-adds classes to slides when scrolling/moving, causing an unnecessary performance penalty #7355

Closed
6 tasks done
WesselKroos opened this issue Mar 6, 2024 · 0 comments

Comments

@WesselKroos
Copy link
Contributor

Check that this is really a bug

  • I confirm

Reproduction link

https://codesandbox.io/p/sandbox/swiper-default-forked-gx2lnh?file=%2Findex.html%3A63%2C48

Bug description

When freeMode is enabled every scroll(move) event re-adds the active, previous and next classes. This causes a performance penalty because it triggers unnecessary style recalculations on the active, previous and next slides.

Expected Behavior

The active, previous and next classes are only removed or added when necessary:

After.mp4

Actual Behavior

The active, previous and next classes are continuously re-added in every scroll(move) event:

Before.mp4

Swiper version

11.0.7

Platform/Target and Browser Versions

All platforms/targets

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
2 participants