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

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

Closed
6 tasks done
WesselKroos opened this issue Apr 30, 2024 · 0 comments · Fixed by #7505

Comments

@WesselKroos
Copy link
Contributor

Check that this is really a bug

  • I confirm

Reproduction link

https://codesandbox.io/p/sandbox/swiper-default-forked-477vky

Bug description

(This is similar to previously reported performance issue #7355, but for another slide class this time.)

When watchSlidesProgress is enabled every scroll(move) event re-adds the slideVisibleClass and slideFullyVisibleClass classes. This causes a performance penalty because it triggers unnecessary style recalculations on the (semi-)visible slides.

Expected Behavior

The slideVisibleClass and slideFullyVisibleClass classes are only removed or added when necessary:

After.mp4

Actual Behavior

The slideVisibleClass and slideFullyVisibleClass classes are continuously re-added in every scroll(move) event:

Before.mp4

Swiper version

11.1.1

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
1 participant