metafizzy / flickity

:leaves: Touch, responsive, flickable carousels
https://flickity.metafizzy.co
7.53k stars 603 forks source link

Bug in resize function caused by #1177 fix #1202

Open andyexeter opened 2 years ago

andyexeter commented 2 years ago

Test case: https://codepen.io/andyexeter/pen/mdBZJwb

Hey,

A bug has been introduced in https://github.com/metafizzy/flickity/commit/73249f9002f6af3160452f6c7591366094279524 which was added as a fix for #1177

Now that the resize function bails if the carousel is animating, triggering any elements within a cell to show on an adaptiveHeight carousel and then resizing doesn't work.

In the test case, if you scroll to cell 2 then click the "Show" button nothing happens. However, if you reload, scroll to cell 2 and wait a couple of seconds for the animation to settle and then click Show, the carousel is resized correctly to show the new visible content.

I've added a commented out temporary workaround to the test case, where I check the isAnimating property before calling resize and if it's true I wait for a settle event to fire before resizing. This kind of works, but there's a noticeable delay between clicking the button and the resize occurring.

animaux commented 2 years ago

Thanks @andyexeter! Your workaround has helped me with another problem:

Flickity did not trigger a resize if fullscreen mode is exitied during an animation.

desandro commented 1 year ago

Thanks for reporting this issue. This may be a necessary trade-off to deal with iOS 15 browser resize behavior.

paubou commented 7 months ago

having the same issue, Flickity do not trigger a resize of the flickity-viewport if the animation is not over. Resulting in a 0px height slider when exiting the fullscreen.