Rahul Dey Posted August 24, 2020 Share Posted August 24, 2020 I am working on a animation where I have to detect when user stops the scrolling how can I detect from the ScrollTrigger onUpdate callback. Please Help! 1 Link to comment Share on other sites More sharing options...
mikel Posted August 24, 2020 Share Posted August 24, 2020 Hey @Rahul Dey, Welcome to the GreenSock Forum. You could add a listener for "scrollEnd" - more here. Just an example See the Pen c1099fe6d3d8c43ec2b928f006551450 by mikeK (@mikeK) on CodePen Happy scrolling ... Mikel 5 Link to comment Share on other sites More sharing options...
Rahul Dey Posted August 24, 2020 Author Share Posted August 24, 2020 Thanks for replying so quick. But scrollEnd event is a global event what if I want in particular instance. Maybe we could do some sort of state management. Like let section1_active = false; const section1Tl = gsap.timeline({ scrollTrigger: { trigger: ".section1", onUpdate: (self) => { section1_active = self.isActive }, } }) ScrollTrigger.addEventListener("scrollEnd", () => { if(section1_active) { // Do Something } }); Link to comment Share on other sites More sharing options...
mikel Posted August 24, 2020 Share Posted August 24, 2020 Hey @Rahul Dey, It would be good to see your case reduced to the specific aspect in a CodePen. If you then have any questions, it will be easier to offer you help. 1 Link to comment Share on other sites More sharing options...
ZachSaucier Posted August 24, 2020 Share Posted August 24, 2020 If you want to know when the end of a ScrollTrigger section has been reached, use the onLeave callback. 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