ytrabelsi Posted April 28, 2023 Share Posted April 28, 2023 Hi, i'm trying to make a parallax effect on the background. i"m trying to access to div using the class generated by react when i load the page the script run but the gsap code shows an error but when i copy paste the same script i runs well See the Pen ExdvjeB by ytmicrocom (@ytmicrocom) on CodePen Link to comment Share on other sites More sharing options...
GSAP Helper Posted April 28, 2023 Share Posted April 28, 2023 It sounds like you must be calling that code when the element doesn't actually exist. It's pretty tough to troubleshoot without a minimal demo - the one you provided doesn't illustrate the issue properly. Well, it does but obviously it's because your element doesn't exist. Would you please provide a very simple CodePen, Stackblitz or CodeSandbox that demonstrates the issue? Here's a Stackblitz starter template that you can fork - it already imports GSAP/ScrollTrigger and shows how to use gsap.context() Please don't include your whole project. Just some colored <div> elements and the GSAP code is best. Once we see an isolated demo, we'll do our best to jump in and help with your GSAP-specific questions. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now