Jump to content
Search Community

ScrollTrigger, REACT and Vertical scrolling effect

steen hjalmar larsen test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

  • Solution

It looks like you set the container to display: flex which turns off pinSpacing by default because padding/spacing works differently in that context. So just set pinSpacing: true to override that default: 

 

https://codesandbox.io/s/gsap-scroll-forked-q8x1nl?file=/src/App.js

 

I also noticed that you forgot to add an empty dependency array to the useEffect() which I think is required in React, otherwise it'll get called every time the component renders. 

Link to comment
Share on other sites

15 hours ago, GreenSock said:

Actually that isn't true - look at the console: 

 

 

You are right that there is a difference in what is registered as a parent node
In Vanilla JS it is "#root", while in React it is first "#root" and then it changes to ".pin-spacer"
Can see that GSAP changes the DOM

 

THANK YOU once again for your responsec 💕

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