【发布时间】:2019-08-20 14:35:12
【问题描述】:
我对此代码有疑问:Codepn project
我希望每次向下滚动时都会显示下一部分。同时,只有第二个正在显示...
我还希望它使用鼠标滚动顶部返回到上一张幻灯片
我想得到的效果:LOOK THIS WEBSITE
显示我正在使用:
function handleMouseWheelDirection( direction )
{
console.log( direction ); // see the direction in the console
if ( direction == 'down' ) {
goNextSlide();
} else if ( direction == 'up' ) {
goPrevSlide();
} else {
// this means the direction of the mouse wheel could not be determined
}
}
goNextSlide 函数:
const goNextSlide = () =>{
TweenMax.to(sectionMain, 2, {x:0, y:-100} );
TweenMax.to(slide1, 0, {delay:0.4, x:0, y:0, ease: Power4.easeOut, display:"block" } );
}
请查看 codepen,以便更好地了解我。有任何想法吗?谢谢。
【问题讨论】:
-
嘿西蒙。我强烈建议在this page 上修改 Craig 的演示,因为它将解决您的很多问题,而不必自己编写代码。一般来说,the GreenSock forums 是更快获得高质量帮助的更好地方。
标签: javascript jquery html css gsap