Jump to content
Search Community

How to animate slider captions if position is fixed?

mrWilson test
Moderator Tag

Recommended Posts

Hi, I'm using Swiper slider, and I've created fixed position captions for it. I don't want them to move with the slide as usual, so I lifted captions out of the slide. I got it to work, but I'm having trouble animating them. I don't know how to do it. :( For example: if the slide changes then the previous slide titles fade out + slide up, and the next slide titles fade in + slide up. 

 

Thank you.

 

 

See the Pen gOPOOdp by mrWilson123 (@mrWilson123) on CodePen

Link to comment
Share on other sites

12 minutes ago, mrWilson said:

It's because i don't know how to animate titles with gsap in this particular situation. I was hoping someone could help me with that.

Well, you'd need to put something in the callback for the transition. I believe that's slideChangeTransitionStart in your example. Only instead of switching out the content you'd do something like (in pseudo-code):

gsap.to(currTitle, {autoAlpha: 0, y: -100});
gsap.from(nextTitle, {autoAlpha: 0, y: 100});

I'm not familiar with Swiper to know what those references should be. You could just build the whole thing with GSAP:

 

Perhaps the Getting Started article for GSAP can help:

 

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