davidjerleke / embla-carousel

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

Resize handler precision mismatch #571

Closed davidjerleke closed 1 year ago

davidjerleke commented 1 year ago

Discussed in https://github.com/davidjerleke/embla-carousel/discussions/569.

Bug description

Originally posted by **hamidrezahanafi** September 18, 2023 The trigger to resize observer is coming from a height change in the slides but we only check the widths for an axis x slider. In this case width didn't change but upon checking the old width 163.890625 and new width 163.89060974121094 it seems that style width and observer width have different precision. 163.890625 is the actual rounded number of 163.89060974121094. So library trigger a resize event without any width change which I think is library issue. ### Suggested solution - [See comment](https://github.com/davidjerleke/embla-carousel/discussions/569#discussioncomment-7045825). - This also solves #568.