Hi,
I am trying to change each nav item color from white to black or back depending on the section class (i.e background color) behind it.
The navigation is fixed as the content comprised of sections with class="section-white" or class= "section-dark" scrolls beneath it.
The script below changes all links simultaenously. Has anyone any suggestion as to what I am doing wrong?
Thanks!
const sections = gsap.utils.toArray('.section-white');
sections.forEach(section => {
ScrollTrigger.create({
trigger: section,
duration:3,
start: 'top 300px',
end: 'bottom 80px',
scrub: 1,
toggleClass: {
targets: '.nav-link',
className: 'text-black'
},
markers: true,
})
});