Hello GSAP masters,
I'm trying to figure out having my navbar changing its theme when it reaches a specific section with [data-theme="dark"] applied. Right now, what I do is using ScrollTrigger which I demonstrated in my CodePen. But some problems that I encountered:
When the navbar is changing color, it doesn't happen smoothly. It's laggy and the element is changing one by one as opposed to all at once
It doesn't detect the other section that also has the same id applied
I feel like the code is messy and could be better, but I'm a newbie at this so I can't figure it out
What I have in mind is when the navbar enters the section with [data-theme="dark"] applied, the navbar itself can automatically apply the [data-theme="dark"] as well. Is that possible? Or is there any better approach for this?
Thank you very much for your help!