Hello, I have been searching for a while, and trying different configurations for a solution to this problem, but just can't get it working.
I'm trying to run the same timeline (that has a class of .fade-wrap) each time it/any enters the viewport. As you will see in the CodePen, I have seen in other examples to wrap code with a foreach like:
const fadeSections = gsap.utils.toArray(".fade-wrap");
fadeSections.forEach((fadeSection) => {
animation code here
});
But it still runs the timeline on both as soon as the first one enters the viewport. I'm sure this is a simple fix, but I just cannot get it! Any help is greatly appreciated!