Jump to content
GreenSock

Cartos

How to create courosel without infinite loop

Recommended Posts

Hi there,

Is it possible to disable infinite loop as I want to user to slide right or left for going through items. After reaching to end user can not drag more.

See the Pen GRJwLNP by GreenSock (@GreenSock) on CodePen

Link to comment
Share on other sites

Hey there! Sure - what have you tried so far?

  • Like 1
Link to comment
Share on other sites

Hi Cassie,

 

I have a very messy code in my local as I have tried every possible way I know. I used above code and playing with it. But no required so far. If you could just let me know how we can stop infinite loop. 

I set repeat 0 also but it is not stoping repeat.

  • Like 1
Link to comment
Share on other sites

I'm afraid I'd have to dig in to this pen, work out what's happening and figure that out myself - if I knew the answer I'd happily just tell you. I don't have the time for this right now. I'll take a look later if no one else has jumped in but here's where I would start.

Right now the progress of the timeline is being wrapped using a GSAP util so that when it gets past 1 it loops back to the beginning and starts at 0 again.

https://greensock.com/docs/v3/GSAP/UtilityMethods/wrap()

you will want to change that so that the value can only be between 0 and 1. i.e. the start and the end of the timeline.

Link to comment
Share on other sites

Removing the autoplay for now and just manually clicking through and doing some console.log()'s would also be a good start.

  • Like 1
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.
×