Manual loop #5151
Unanswered
code-hero-projects
asked this question in
Q&A
Manual loop
#5151
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using Swiper 7.2.0 with React 17.0.2 and I'm trying to do a manual loop without user interaction. To do this I started by creating a wrapper dor the Swiper component and set the loop prop to true and allowTouchMove prop to false. After that added a useEffect hook to call slideToLoop whenever a slide needed to be changed:
A parent component would then call this with as many slides as it wants, and update the changeIndex prop want a slide needs to change:
This works fine for the first time it loops. It goes through all the slides back to the first one, as displayed in the attachment.
The problem is that it stops on the first slide after the loop and it doesn't continue. Is there a way around this? Am I missing some property to set in the Swiper component?
Any help would be very appreciated, thank you!
loop-example.mp4
Beta Was this translation helpful? Give feedback.
All reactions