chester Posted October 29, 2023 Share Posted October 29, 2023 Hi, I'm trying out for my local project in Astro (https://astro.build/) how smoothScroll works, unfortunately after connecting the script, I tried directly attaching from cdn (https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/ScrollSmoother.min.js) or downloading and attaching the file and I get an error: Uncaught TypeError: Cannot set property window of #<Window> which has only a getter I don't know how to deal with this, is there a solution? The gsap itself works without a problem. Link to comment Share on other sites More sharing options...
GreenSock Posted October 29, 2023 Share Posted October 29, 2023 It's very difficult to troubleshoot without a minimal demo, but my guess is that maybe you didn't register the plugin? gsap.registerPlugin(ScrollTrigger, ScrollSmoother) And make sure you do that when the window and document exist. Some SSR frameworks run things twice - once on the server (when there's no window or document yet) and then again in the browser. You should only run the GSAP-related code in the browser (when window and document objects exist). If you still need help, please make sure you provide a minimal demo. There are a bunch of starter templates at https://gsap.com/demos 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