Hi all!
I'm having some issue to figured out what is not working with "onEnterBack:()"
I have a simple sticky nav that every time sections appear on scroll a class is added to the nav item associated.
const panels = gsap.utils.toArray(".panel");
const navLinks = gsap.utils.toArray(".sticky-infos div");
panels.forEach((panel, i) => {
ScrollTrigger.create({
trigger: panel,
start: "top 15%",
onEnter: () => {
navLinks.forEach((e) => {
e.classList.remove("active");
});
navLinks[i].classList.add("active");
},
onEnterBack: () => {
navLinks.forEach((e) => {
e.classList.remove("active");
});
navLinks[i].classList.add("active");
},
});
});
Actually it works pretty good but something "onEnterBack" doesn't work properly (class "active" is not added).
Should I use other parameters?