Thanks Zach, so just to be clear, I should be calling ScrollTrigger.refresh() on unMount inside of my UseEffect for each component? Or where do I add this exactly?
So like this?
useEffect(() => {
let c1 = gsap.timeline({
scrollTrigger: {
id: "screen",
trigger: trigger.current,
pin: wrapper.current,
scrub: 1,
markers: true,
start: "top top"
}
});
c1.to(img1.current, {
duration: 2,
yPercent: -70,
ease: "power4.inOut"
});
// Need to unmount these
return () => {
ScrollTrigger.refresh(); // New Line
c1.kill();
};
}, []);
I can make these other adjustments, should the gsap.registerPlugin(ScrollTrigger);be inside of _app.js, or the parent page where the components are imported (like case.js)?