How to change style effects (turn selected on and off) depending on scroll position?


I’m creating a sticky subnav that appears up on scrolldown. Now, I’d like to set a state of each nav element to selected or not selected, depending on if the related content is showing. Just like this:

My issue is that I can set it to selected when it hits a certain Y scroll number… but then it won’t turn off. I think it’s just reading the first case and ignoring the second one.


Ok I’m answered my own question… it’s a drag I can’t delete it though…