const pinLinks = gsap.utils.toArray('.pinScroll > div');
pinLinks.forEach((pinLink, index) => {
const lastpinLinks = document.querySelector('.pinScroll > div:last-child');
ScrollTrigger.create({
trigger: pinLink,
start: 'top center',
end: () => `+=${pinLink.clientHeight}`,
toggleActions: 'play reverse none reverse',
toggleClass: { targets: pinLink, className: "active"},
});
});
The above code works fine for me to toggleClass based on scroll, but it removes the active class from the last child, which I don't want.
Can you please tell me how can is keep active class on last child?