anaig Posted January 15, 2022 Share Posted January 15, 2022 Hi there! I'm extremely new to GSAP (aka this is my first time trying things) and I'm coming across some weird stuff. So i'm trying to make that blob in the middle increase in size to take up the whole page as i scroll down. The problem is that it's working perfectly in codepen, but not on my live preview locally. Nothing happens in my live preview - when i scroll the blob stays the same, i can't get any animation to play. I also can't get the markers to show up on live preview. I'm using vscode and the live preview on my index.html file. This is what the <head> looks like in my index.html file: <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.9.1/gsap.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.9.1/ScrollTrigger.min.js"></script> <script src="js/script.js"></script> <link rel="stylesheet" href="css/stylesheet.css" type="text/css" charset="utf-8" /> <title>title</title> </head> Thanks in advanced for your help! Ana See the Pen dyVapQP by anaignat (@anaignat) on CodePen Link to comment Share on other sites More sharing options...
GreenSock Posted January 15, 2022 Share Posted January 15, 2022 Welcome to the forums, @anaig! Without seeing the problem, my best guess is that your script.js is executing code immediately, BEFORE the <body> is even parsed by the browser, so you're trying to animate things that don't even exist yet. Solution: either put your script just before the closing </body> tag or simply wrap your code in a "load" event listener so that things actually exist when you try animating them Good luck! 3 Link to comment Share on other sites More sharing options...
anaig Posted January 15, 2022 Author Share Posted January 15, 2022 ah makes sense! by script do you mean this line: '<script src="js/script.js"></script>' or my actual gsap js script (to be moved before the closing </body> tag)? i understand now! it works thank you so much 1 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