Jump to content

Boski Mehta

Last element should not fade out when scroll top to bottom or bottom to top

Moderator Tag

Recommended Posts

Hi ,I have fixed the div and fade in fade out the text between them but when the user reaches to the end the last next need to stay rather than fade out. Please check

See the Pen LYmPBLW by boskim (@boskim) on CodePen

Link to comment
Share on other sites

thanks for the demo.


option 1: instead of using a stagger use a loop to create the animations and add them to the timeline. inside your loop run a condition that checks if you're on the last iteration. if yes, don't add that animation to the timeline.


option 2: use a function based value for the autoAlpha property in the stagger. with this technique you can run a condition on each target to see if it is the last or not. based on that condition you can return a custom value. here is a demo for option 2


See the Pen rNvBQYV by snorkltv (@snorkltv) on CodePen

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