Ak89 Posted November 5, 2021 Share Posted November 5, 2021 Hi, I just forked the ScrollTrigger with locomotive scroll codepen example and made some small changes to the javascript code. Basically, I put the code in a class and instead of defining a const locoScroll, I used the this keyword and this.locoScroll. With the class definition and original const declaration, everything works fine, but the code breaks when I use this.locoScroll instead. I realize this might not be related to ScrollTrigger, but since the error is happening inside the ScrollTrigger.scrollerProxy callback, I'd thought I could ask here. Thanks for any help in advance. See the Pen rNzdByY?editors=0011 by Akbarbakhshi (@Akbarbakhshi) on CodePen Link to comment Share on other sites More sharing options...
Solution OSUblake Posted November 5, 2021 Solution Share Posted November 5, 2021 You would need to use arrow functions as they aren't scoped... scrollTop: (value) => { return arguments.length ? this.locoScroll.scrollTo(value, 0, 0) : this.locoScroll.scroll.instance.scroll.y; }, 3 Link to comment Share on other sites More sharing options...
Ak89 Posted November 5, 2021 Author Share Posted November 5, 2021 oh.. I see. Thank you. 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