Jump to content
Search Community

Fade in and out child content based on scrolling parent

Christian Dimas test
Moderator Tag

Recommended Posts

Hey folks, I've managed to build a simple horizontal scrolling based on the ScrollTrigger example and it works quite well IMO.

 

Each of the slide has a content div which holds all the overlaid text for the slide. I want the content div to fade in slowly when the slider is starting to enter the viewport, and then starts fading out when the slide is almost out of view. But I can't find a way to make this work. 

 

Also I'm wondering, is it possible to make the fade-in & fade-out transition tied to the scroll? So if the user isn't scrolling the opacity won't change.

 

Any suggestion on how to create that?

 

Thanks!

 

Edit: the content div is positioned fixed by design, so it will fade in and out at the center of the page

See the Pen NWwbXMO by _christiandimas (@_christiandimas) on CodePen

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