0

アイテムが移動しているときにアイテムが .5 にスケーリングされている間に水平スクロールを作成しようとしていますが、Foreach で scrollTrigger を作成することはできません。 /eYWMrEW


sections.forEach((section,index) => {
    
    let tl = gsap.timeline({
        scrollTrigger: {
            trigger: section,
            pin: true,   // pin the trigger element while active
            start: `top top-=${section.clientHeight*(index)}`, // when the top of the trigger hits the top of the viewport
            end: `+=${section.clientWidth+section.clientWidth*(index)}`, // end after scrolling 500px beyond the start
            scrub:true,
            toggleClass:'active',
            pinSpacing:false,
        }
      });

      tl.to(section, {xPercent: -100 * (sections.length-1)});
});```

Also I cannot put the active class on the current section
4

0 に答える 0