Jloafs Posted October 10, 2022 Share Posted October 10, 2022 Hi guys. I'm trying to add Scroll Smoother to Wordpress but getting errors. Can I just check this is the correct way to include? I have added the ScrollSmoother.min.js file to a folder called 'js' and am enqueueing the script in my functions.php file like so: wp_register_script('scrollsmoother', get_template_directory_uri() . '/js/ScrollSmoother.min.js', array(), 1, true); wp_enqueue_script('scrollsmoother'); Is this the correct way? Here's the errors btw: ScrollSmoother.min.js?ver=1:10 Uncaught TypeError: Cannot read properties of undefined (reading '_getVelocityProp') at Function.register (ScrollSmoother.min.js?ver=1:10:825) at _createPlugin (gsap.min.js?ver=1:10:40546) at gsap.min.js?ver=1:10:40564 at Array.forEach (<anonymous>) at Object.registerPlugin (gsap.min.js?ver=1:10:40069) at ScrollSmoother.min.js?ver=1:10:8984 at ScrollSmoother.min.js?ver=1:10:140 at ScrollSmoother.min.js?ver=1:10:175 register @ ScrollSmoother.min.js?ver=1:10 _createPlugin @ gsap.min.js?ver=1:10 (anonymous) @ gsap.min.js?ver=1:10 registerPlugin @ gsap.min.js?ver=1:10 (anonymous) @ ScrollSmoother.min.js?ver=1:10 (anonymous) @ ScrollSmoother.min.js?ver=1:10 (anonymous) @ ScrollSmoother.min.js?ver=1:10 ScrollSmoother.min.js?ver=1:10 Uncaught TypeError: Cannot read properties of undefined (reading '_getVelocityProp') at Function.register (ScrollSmoother.min.js?ver=1:10:825) at _createPlugin (gsap.min.js?ver=1:10:40546) at gsap.min.js?ver=1:10:40564 at Array.forEach (<anonymous>) at Object.registerPlugin (gsap.min.js?ver=1:10:40069) at animation.js?ver=1:8:6 register @ ScrollSmoother.min.js?ver=1:10 _createPlugin @ gsap.min.js?ver=1:10 (anonymous) @ gsap.min.js?ver=1:10 registerPlugin @ gsap.min.js?ver=1:10 (anonymous) @ animation.js?ver=1:8 Link to comment Share on other sites More sharing options...
Solution GreenSock Posted October 11, 2022 Solution Share Posted October 11, 2022 First of all, thanks for being a Club GreenSock member, @Jloafs! It sounds to me like maybe you're using an old version of ScrollTrigger on your site (with a mis-matched ScrollSmoother version). I'd definitely recommend using the latest version of everything (3.11.3 as of right now). And you are loading ScrollTrigger too, right? And GSAP of course. Link to comment Share on other sites More sharing options...
Jloafs Posted October 11, 2022 Author Share Posted October 11, 2022 Of course - you're absolutely right 😀 Thanks so much. 2 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