AsKadir Posted March 2, 2020 Posted March 2, 2020 Hi! I need an advice for this slider, I want to implement autoplay, but all my approaches are futile. Is it too hard to make autoplay here? Or is it better to create slider with another concept? Can you help me, please? See the Pen gOpxYJj by ChicagoJostik (@ChicagoJostik) on CodePen.
ZachSaucier Posted March 2, 2020 Posted March 2, 2020 Hey Aslan. There are many ways to add auto-play. There are also a lot of sliders in these forums that have auto-play functionality. The core concept is calling a function every N seconds. Most the time if a user interacts with the slider (say clicks the next or previous button) the timeout or whatever is going to call the function again is either reset or cancelled. We're happy to help if you have a more specific question! 2
AsKadir Posted March 2, 2020 Author Posted March 2, 2020 12 minutes ago, ZachSaucier said: Hey Aslan. There are many ways to add auto-play. There are also a lot of sliders in these forums that have auto-play functionality. The core concept is calling a function every N seconds. Most the time if a user interacts with the slider (say clicks the next or previous button) the timeout or whatever is going to call the function again is either reset or cancelled. We're happy to help if you have a more specific question! @ZachSaucier Sorry for disturbing you, Zach. I've reviewed every slider here in forum maybe for 10 times, but it's always hard for me to understand javascript. After your words I understood that I can use something like this: gsap.to({}, 5, {onRepeat:nextClick, repeat:-1}); and it's pretty working, but now another question, as you say, for example, next button is clicked and now I need to reset this tween, how can I make it?
ZachSaucier Posted March 2, 2020 Posted March 2, 2020 2 minutes ago, AslanGoi said: After your words I understood that I can use something like this: gsap.to({}, 5, {onRepeat:nextClick, repeat:-1}); It's probably be best to use .delayedCall() instead: See the Pen mdJMypV?editors=0010 by GreenSock (@GreenSock) on CodePen. 2 1
AsKadir Posted March 2, 2020 Author Posted March 2, 2020 9 minutes ago, ZachSaucier said: It's probably be best to use .delayedCall() instead @ZachSaucier Now it's working! Thanks a lot!!!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now