Share Posted May 9, 2022 Is there a way to unobserve the component if it reaches a certain index? Example. If I have 10 elements and is Observing the scroll or mouse wheel for that element. Per scroll one element will animate. Then when it reaches the last element (10th element) it will stop observing it and will proceed with the normal scrolling. But if I scroll back to that Component (with observer previously attached) it will start Observing the element again and animate the element inside it again. Just like in the sample codepen above. It scrolls like a carousel. But what I want is when it reaches the last element it will stop its observer so that I can continue with the normal scroll. Is there a way to do that? See the Pen XWzRraJ by GreenSock (@GreenSock) on CodePen Link to comment Share on other sites More sharing options...
Solution Solution Share Posted May 9, 2022 You can check for that condition and then disable the observer. https://greensock.com/docs/v3/Plugins/Observer/disable() But I would advise against trying combine normal scrolling with the Observer as it can get overly complicated. That is something you will need to figure out on your own. 2 Link to comment Share on other sites More sharing options...
Author Share Posted May 9, 2022 29 minutes ago, OSUblake said: You can check for that condition and then disable the observer. https://greensock.com/docs/v3/Plugins/Observer/disable() But I would advise against trying combine normal scrolling with the Observer as it can get overly complicated. That is something you will need to figure out on your own. You're my SUPERHERO!!! LEGEND as always.. thanks dude 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