Jump to content
Search Community

ScrollTrigger conditional toggleClass

nosugar test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

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)  **** 
 

410628279_ScreenShot2021-10-27at10_52_07PM.png.c042572cdb4dc052f7facbee5d74c3ea.png

 

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...