nosugar Posted October 28, 2021 Share Posted October 28, 2021 I am toggling class at box-container (black borderbox on left) based on selector's (color boxes) start and end point while scroll. I try to find a way to avoid toggleClass when distance between next start point and current end end point is too short. ( want to implement toggleClass only if this distance is larger than box height ) **** Screenshot that issue happened (passed end and about to pass next start) **** I was trying to achieve this with scrolltrigger's callback functions but it was too complicated and failed to get the distance between endpoint and next start point. See the Pen bGrRWKJ by nosugarsociety (@nosugarsociety) on CodePen Link to comment Share on other sites More sharing options...
Solution GreenSock Posted October 28, 2021 Solution Share Posted October 28, 2021 If I understand your goal correctly, you could run some custom logic in an onToggle like this: See the Pen porwrja?editors=0010 by GreenSock (@GreenSock) on CodePen Is that what you're looking for? 2 Link to comment Share on other sites More sharing options...
nosugar Posted October 28, 2021 Author Share Posted October 28, 2021 Thank you so much. I really did not know that i can use next(), previous() and its end and start. This is exactly logic what I have been looking for all day. 1 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