I'm actually trying to apply my scrolltrigger parallax effect only when my element in in viewport but I can't make it works ... Has someone already went through something similar ? Can someone help me wake it works ?
Here's the demo : Codepen
if (ScrollTrigger.isInViewport(".block-1")) {
gsap.to(".block-1", {
yPercent: 100,
ease: "none",
scrollTrigger: {
trigger: ".block-1",
start: "top bottom",
end: "bottom top",
scrub: true,
markers: true,
id: 'block-1'
},
});
}
Thanks in advance.
Valord