flickity icon indicating copy to clipboard operation
flickity copied to clipboard

Bug in resize function caused by #1177 fix

Open andyexeter opened this issue 3 years ago • 3 comments

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.

andyexeter avatar Jan 20 '22 17:01 andyexeter

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

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

animaux avatar Apr 19 '22 19:04 animaux

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

desandro avatar Jan 18 '23 04:01 desandro

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.

paubou avatar Feb 27 '24 14:02 paubou