Open moymadethis opened 5 months ago
I think this is caused by the origin
setting? And because my carousel autoplays/loops, I don't actually need it to recalculate/realign.
Is there a way to disable origin
recalculating? I think the only options are auto/centre/number (value)?
I don't know for sure - but I'm guessing the initial vertical scroll is being interpreted as a resize event which is why the carousel slides jump to the edge of the grid (realigning). Once it's got that out the way, scrolling up/down doesn't cause an issue.
I have an autoplaying, smooth, looping carousel. This works as intended with the exception of one instance.
When testing the carousel on my iPhone 15, with both Safari and Chrome, the carousel scrolls as it should on load. However as soon as I scroll down the page and the address bar resizes, the carousel slides jump so one aligns to the edge of the carousel - I assume the slide that is closest to the edge/starting point, as if 'snap' was enabled. Once that occurs, the carousel scrolls as intended again and scrolling up/down the page causes no issues. It just occurs on the first scroll. So if you refresh the page this would start over again.
I've include the core HTML/Javascript in this JSFiddle for reference but I appreciate that might be difficult to view on mobile! But it should demo the expected effect - and I've added the Keen-specific script at the bottom of the post.
Has anyone encountered this and can anyone think of a solution? To prevent this?
I suppose a linked issue/question would be what is the best way to implement a smooth, auto-scrolling, looping carousel like in the example? Maybe it is the approach I've taken rather than the iOS 'bug'?
Thanks in advance!
Keen-Slider specific script: