Jump to content
Search Community

Change opacity of element as ScrollTrigger scrolls horizontally

amit95 test
Moderator Tag

Recommended Posts

I'm using ScrollTrigger pin to turn my section into a horizontal scroll section.

 

In this section, I have an element called .horizontalScroller__intro . On scroll, say 20% of the width of .horizontalScroller__items , I'm trying to gradually fade the intro away, so that the image is the only thing in view. 

 

To achieve this, I've created a timeline, similar to the approach defined here.

 

However, in my demo, my intro disappears immediately.

 

In short:

  • When scrolling down (start to end of image), slowly fade away .horizontalScroller__intro
  • When scrolling up (end to start of image), slowly fade .horizontalScroller__intro back in

 

Note: Please view the pen in full view.

 

See the Pen wvPaVpz by amit_rai95 (@amit_rai95) 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...