当我的项目在移动时缩放到.5,但无法在foreach中实现滚动触发时,我尝试进行水平滚动
const sections = gsap.utils.toArray(".section");
gsap.to(sections, {
xPercent:-100*(sections.length-1),
ease: "none",
scrollTrigger: {
trigger: ".container",
pin: true,
snap:1/(sections.length-1),
scrub: true,
end:`+=${document.querySelector('.container').offsetWidth}`,
}
});
sections.forEach(section=>{
gsap.to(section, {
scale:.5,
ease: "none",
scrollTrigger: {
trigger: section,
pin: true,
scrub: true,
end:`+=${$(section)[0].offsetWidth}`,
markers:true
}
});
});````
Also I cannot put the active class on the current section
暂无答案!
目前还没有任何答案,快来回答吧!