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

Auto Height support #113

Closed
peps opened this issue Oct 27, 2020 · 11 comments · Fixed by #268
Closed

Auto Height support #113

peps opened this issue Oct 27, 2020 · 11 comments · Fixed by #268
Labels
feature request New feature or request resolved This issue is resolved

Comments

@peps
Copy link

peps commented Oct 27, 2020

Hi! I'm loving using Embla, but it seems to be missing a common feature that would make it perfect.

Would it be possible to add auto-height support? So when showing 1 slide at a time, the height of the container changes to match the current slide.

@davidjerleke
Copy link
Owner

davidjerleke commented Oct 28, 2020

Edit

An auto height plugin is available as of v6.1.0.

OP

Hi Aaron (@peps),
Thank you for your question.

The vision for Embla Carousel is that it should be a lightweight bare bones carousel library. So it should basically solve the hardest technical challenges with building great carousels and do it good.

I think adaptive height is quite easy to achieve utilizing the Embla Carousel API so I think this feature should be left out of the Embla core.

With that said, do you want me to create a CodeSandbox that demonstrates how to achieve this?
If yes, are you using the vanilla-JavaScript or React version of Embla?

Best,
David

@davidjerleke davidjerleke added the feature request New feature or request label Oct 28, 2020
@peps
Copy link
Author

peps commented Oct 29, 2020

Hey David, thanks for the quick response. Makes sense wanting to keep it light, I ended up forcing my client to upload their images at consistent sizes, so I no longer need the functionality. But I have used adaptive height in the past with other carousels.

You're right though, if I ever need it again in the future, I could build it using the API. Ill just close the issue with this comment, thanks again ;)

@peps peps closed this as completed Oct 29, 2020
@davidjerleke
Copy link
Owner

davidjerleke commented Oct 29, 2020

Hi Aaron (@peps),

Thanks for the response and I'm glad my reasoning made sense to you 🙂. Feel free to reach out if you would like me to create a CodeSandbox demonstrating an adaptive height carousel with Embla in the future.

Kindly,
David

@davidjerleke davidjerleke added the not planned Won't be investigated unless it gets lots of traction label Oct 29, 2020
@vntw
Copy link

vntw commented Oct 29, 2020

Hey @davidcetinkaya,

I'm currently looking into this (nice timing), but I don't want to take much of your time for a demo, could you in a few words describe how you would achieve this the embla way before I try my approach(es) below?

I was looking at the examples (Lazy-Load to be specific since it has 1 slide displayed) and currently without testing I'd try to change the height in the scroll/select event and set the height of the .SceneDefault-sc-189h1k3-0 container (sorry don't know the internal name) to the slide's height. Would that be somewhat correct?

Thanks for your incredibly helpful responses, helped me already a few times in the past 🙂

@davidjerleke
Copy link
Owner

davidjerleke commented Oct 29, 2020

Hi @venyii,
Thank you for your question.

I decided to create a CodeSandbox to demonstrate how to achieve adaptive height with Embla. Maybe there are more people out there that would like to implement this so I figured the sandbox could be helpful. Please note that I didn't add a smooth CSS height transition to the viewport in the example, but that could be added quite easily so I'm going to leave that up to you.

Thanks for your incredibly helpful responses, helped me already a few times in the past 🙂

I'm glad you find them helpful. If it's not too much to ask, I would appreciate if you gave the responses you have in mind a thumbs up or similar. This could help other visitors/users looking to implement similar features.

Let me know if the CodeSandbox helps.

Best,
David

@vntw
Copy link

vntw commented Oct 29, 2020

Oh wow thank you very much! Hope others find it helpful as well in the future 🙂 I went back and tried to find the helpful responses in my case and gave a 👍

Thanks again for your work!

@davidjerleke
Copy link
Owner

Thanks for the help @venyii. Enjoy 🙂.

@davidjerleke davidjerleke added resolved This issue is resolved question Question about how to achieve something labels Nov 2, 2020
@RoyiAvital
Copy link

Is there a way to have CodeSandbox which uses the CDN only?

@davidjerleke
Copy link
Owner

davidjerleke commented Dec 15, 2020

Thank you for your question @RoyiAvital.
No, sorry. I'm not planning to add CodeSandbox examples using CDN only.

@davidjerleke
Copy link
Owner

davidjerleke commented Jan 13, 2022

Reopening this:

As of v.6 it’s possible to provide plugins to Embla. An Auto Height plugin will be added in the future:

  • #284

@davidjerleke davidjerleke reopened this Jan 13, 2022
@davidjerleke davidjerleke added upcoming A feature or bug fix is on its way for this issue and removed not planned Won't be investigated unless it gets lots of traction question Question about how to achieve something resolved This issue is resolved labels Jan 13, 2022
@davidjerleke davidjerleke linked a pull request Jan 15, 2022 that will close this issue
@davidjerleke davidjerleke added resolved This issue is resolved and removed upcoming A feature or bug fix is on its way for this issue labels Jan 15, 2022
@davidjerleke
Copy link
Owner

I'm happy to announce that this plugin has been released with v6.1.0 🎉.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request resolved This issue is resolved
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants