Auto height to update slider height based on slide height #1071
Replies: 3 comments
-
Yes, please! Adaptive height is very important for sliders on mobile. |
Beta Was this translation helpful? Give feedback.
-
The maintainer did not want to add this, see #227. However good news is that it's relatively easy to add it yourself, see this comment. @NaotoshiFujita , are you willing to reconsider this improvement as more people seem to gain interest in it? |
Beta Was this translation helpful? Give feedback.
-
I expanded a bit on some techniques mention on issue #227 and made it into an extension. Since that discussion is closed, I can repost it here. If anyone can improve on it, I'd be very happy for it – but it seems to work. I've added the following (default) settings, that can simply be added to the
You can keep the extension in the same file as where you're initializing the Splide slider, and add it to the splide like this:
Here's the extension:
NOTE: It also works with dragging, with the only caveat being that when dragging the carousel, the height will adjust after the slide has changed, even when |
Beta Was this translation helpful? Give feedback.
-
Add a automatic height option to update the slider's height based on the height of a slide.
https://splidejs.com/guides/options/#autoheight
autoHeight : true
does not do that.Something like this:
https://owlcarousel2.github.io/OwlCarousel2/demos/autoheight.html
Beta Was this translation helpful? Give feedback.
All reactions