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

Autoheight doesn't work with virtual slides #6570

Closed
5 of 6 tasks
yura3d opened this issue Apr 11, 2023 · 0 comments · May be fixed by ashok9k/Amazon-FE#5
Closed
5 of 6 tasks

Autoheight doesn't work with virtual slides #6570

yura3d opened this issue Apr 11, 2023 · 0 comments · May be fixed by ashok9k/Amazon-FE#5

Comments

@yura3d
Copy link

yura3d commented Apr 11, 2023

Check that this is really a bug

  • I confirm

Reproduction link

https://codesandbox.io/s/withered-dew-3hxgv6

Bug description

Autoheight doesn't work when virtual slides are enabled. There is similar issue (#5846), bit it was closed without any working solutions.

Expected Behavior

Autoheight works fine with virtual slides like it does for regular slides.

Actual Behavior

I checked how swiper implements autoheight. It sets height CSS property manually (through JS) for div with swiper-wrapper class. When virtual slides are disabled, swiper-wrapper gets the height of current active slide. But when virtual slides are enabled, swiper-wrapper always gets 0.

The behavior can be reproduced by comment/uncomment this line in reproduction:

new Swiper('.swiper', {
  autoHeight: true,
  modules: [Virtual],
  virtual: true // <--- THIS
});

Swiper version

9.2.0

Platform/Target and Browser Versions

Windows 11 x64/Google Chrome 112.0.5615.50 x64

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

Successfully merging a pull request may close this issue.

1 participant