Jump to content
Search Community

Reverse a master timeline on click

marius96 test
Moderator Tag

Recommended Posts

I'm trying to create a carousel which shows a box with information when I click on the button.

The animation which fades in '.splide__slide__content'  works on my computer, but doesn't work on CodePen, but that's not the main problem.

What I'm trying to do is to reverse the master timeline when I click on the button again, so it fades out.

Can somebody help out?

See the Pen MWOyJKL by gardellimarius (@gardellimarius) on CodePen

Link to comment
Share on other sites

Hi marius,

 

As we state in the forum guidelines, we don't offer support for 3rd party libraries on this forum, so we really can't offer advice on Splide. 

 

One issue with your pen is that you're not loading GSAP. Another is that you are targeting nextSibling, which could be a text node.

 

As for a master timeline, that is not a good approach for something like this. All your controls and animations should be scoped to a particular slide, and then you toggle the animation inside a click event, kind of like this demo is doing.

 

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

 

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