davidjerleke / embla-carousel

A lightweight carousel library with fluid motion and great swipe precision.
https://www.embla-carousel.com
MIT License
5.37k stars 164 forks source link

embla-carousel-auto-height | Start using ResizeObserver for height calculations #911

Closed lucaspbordignon closed 1 day ago

lucaspbordignon commented 2 weeks ago

Context

After an initial investigation, have noticed that the slideHeights element for embla-carousel-auto-height was being calculated only when initializing the plugin, which does not detect dynamic changes to the carousel elements

The proposed solution leverages ResizeObsevers to detect changes to the slide heights and re-calculate them properly

Solving https://github.com/davidjerleke/embla-carousel/issues/910

Additional Details

ResizeObservers do have relevant coverage with all major browsers, being a good candidate for the solution. Open for new ideas as always on how we could increase support

davidjerleke commented 1 day ago

Will be replaced by this solution.