Jump to content
Search Community

Recommended Posts

zurakobakhidze
Posted

Hi all,

 

I built this slider a while ago. As you can see there is a lot of js bloat but since it worked I was happy with it. Now coming back to it I would like to improve it and make use of loop to be able to add more slider items etc. The logic is pretty simple but also tricky to get right. Any suggestions on how to make the code more efficient while keeping the same functionality?

 

Cheers!

See the Pen dywQreE by Kobakhidze (@Kobakhidze) on CodePen.

Posted

Hi,

 

You are right, that's a lot of code there!

 

Unfortunately we don't have the time resources to comb through all that code and find a way to improve it and/or provide free general consulting.

 

There are plenty of examples in the forums of content sliders. These are just a few:

 

 @PointC

See the Pen YRzRyM by PointC (@PointC) on CodePen.

 

GreenSock collection:

See the Pen jOQXYzV by GreenSock (@GreenSock) on CodePen.

 

See the Pen vYQbZYy by GreenSock (@GreenSock) on CodePen.

 

See the Pen JjrWXNq by GreenSock (@GreenSock) on CodePen.

 

See the Pen QWGXdyd by GreenSock (@GreenSock) on CodePen.

 

Even though their codes are not identical they follow a similar pattern in how to move from one slide to another. Loop or no loop in the code, that's pretty much the key in these scenarios.

 

Hopefully this helps.

Happy Tweening!

  • Like 1
zurakobakhidze
Posted

@Rodrigo No worries, I thought I would ask. Thank you for the references. Cheers!

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...