Jump to content
Search Community

Any suggestions how to improve animation

Ves test
Moderator Tag

Go to solution Solved by PointC,

Recommended Posts

Hello there!
I'm open to any suggestions, how to improve this list animation. I'm trying to create list animation. When we scroll to .target section, scroll stops, and then next animation starting. All good so far. But the list animation is not correct. It's should be visible 3 items in a time, and the middle one is highlighted. But i've got some bugs with it.
I will be grateful for any help.

See the Pen YzeBmpK by vasya-ves (@vasya-ves) on CodePen

Link to comment
Share on other sites

Hi, @PointC !
Your solution is much easier and works like a charm! Thank you so much!

Maybe you have time to clarify 2 things, i don't quiet understand in your code.
Why you disable warnings in tis line gsap.config({ trialWarn: false });
And this line, why multiple by 3?

let newHeight = targets[0].offsetHeight * 3;

Link to comment
Share on other sites

11 hours ago, Ves said:

We multiply by 3, because we want to show 3 items in a time.

Exactly. :)

 

You wouldn't need to do it with JS. You could also just set a height for the <li> elements and manually set a height for the <ul> in your CSS. The trialWarn:false thing is just for CodePen so you don't see any warnings in the console. Nothing at all to do with the animations.

 

Happy tweening.

:)

 

  • Like 2
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...