How can we modify the quantity of slides without re-rendering the carousel? #334
-
I've got a use case where I want to load images into the carousel 12 at a time while the user scrolls through. The problem is, every time I add a group of images, it causes the carousel to animate again. I would prefer that this happen behind the scenes. Here's my now-closed bug report: #330 It seems that the real issue is that modifying the number of slides causes the animation to run. It seems obvious then that I need a way to add/remove slides without triggering a re-render, unless there's a better solution. Any ideas? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Actually, after digging deeper it turns out the issue is how the sliding animation works to begin with. Basically the way it works is pure-react-carousel makes the parent 100% * number of slides. So when you add more slides, it makes it bigger, then the transform animation takes effect. With this manner of handling the sliding, there is no way to handle adding more slides without running into animation triggers. Unfortunately I think this means anyone looking to dynamically add slides needs to use a different package. |
Beta Was this translation helpful? Give feedback.
Actually, after digging deeper it turns out the issue is how the sliding animation works to begin with. Basically the way it works is pure-react-carousel makes the parent 100% * number of slides. So when you add more slides, it makes it bigger, then the transform animation takes effect. With this manner of handling the sliding, there is no way to handle adding more slides without running into animation triggers. Unfortunately I think this means anyone looking to dynamically add slides needs to use a different package.