I've got a panel that uses scrollTrigger and pins the scrolls horizontally and then unpins. At the point of unpinning I'd like to add a class 'stuck'.
The code I'm using for this section is like this
// Research section panel
gsap.to(".panel-wrap", {
xPercent: -200,
x: () => innerWidth,
ease: "none",
scrollTrigger: {
trigger: ".research-section",
start: "top top",
end: () => innerWidth * 3,
scrub: true,
pin: true,
invalidateOnRefresh: true,
anticipatePin: 1,
}
});
I've tried using toggleclass and it partially works but after scrolling further down the page the class is removed. Any ideas?