Jump to content
Search Community

how to make an autoplay in a slider

AsKadir test
Moderator Tag

Recommended Posts

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!

  • Like 2
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...