gpt4 book ai didi

Gsap vertical or horizontal screen is not working Properly(GSAP垂直或水平屏幕无法正常工作)

转载 作者:bug小助手 更新时间:2023-10-24 18:34:52 25 4
gpt4 key购买 nike



I'm having an issue in gsap vertical and horizontal screen, it not stop on full page when i scroll

我在GSAP垂直和水平屏幕上遇到问题,当我滚动时它不会在整页上停止


let sections = gsap.utils.toArray(".section")

sections.forEach((section, i) => {
if ( section.classList.contains('horizontal') ) {

const cardsWrap = section.querySelector('.section__cards')
const oneCard = section.querySelector('.section__card')


gsap.to(cardsWrap, {
x: () => { return -( (cardsWrap.scrollWidth - window.innerWidth + window.innerWidth*0.01) + (window.innerWidth/1 - oneCard.offsetWidth/1) ) },
ease: "none",
scrollTrigger: {
trigger: section,
start:() => "center center",
end: () => "+=" + cardsWrap.scrollWidth,
scrub: 1,
pin:true,
snap: 1 / (sections.length - 1),
pin: i === sections.length -1 ? false : true,
invalidateOnRefresh: true,
anticipatePin: 1,
},
});

} else {

ScrollTrigger.create({
markers: false,
trigger: section,
start: () => "top top",
pin:true,
pin: i === sections.length -1 ? false : true,
anticipatePin: 1,
});
}

});

更多回答
优秀答案推荐
更多回答

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com