【发布时间】:2017-11-04 15:42:00
【问题描述】:
我在我的网站上使用 ScrollMagic,我希望它像 MaterializeCSS Startup Theme 那样工作
我的问题是,在初始加载之后,不同的容器会重叠。在我完全向下滚动并再次向上滚动后,它工作正常。
为了理解我的意思,我创建了一个Pen。
这是我的 JS:
jQuery(function () { // wait for document ready
// init
var controller = new ScrollMagic.Controller();
// define movement of panels
var wipeAnimation = new TimelineMax()
.fromTo("section.panel.turqoise", 1, {x: "-100%"}, {x: "-50%", ease: Linear.easeNone})
.fromTo("section.panel.turqoise", 1, {x: "-50%"}, {x: "-100%", ease: Linear.easeNone})
.fromTo("section.panel.green", 1, {x: "100%"}, {x: "50%", ease: Linear.easeNone})
.fromTo("section.panel.green", 1, {x: "50%"}, {x: "100%", ease: Linear.easeNone});
// create scene to pin and link animation
new ScrollMagic.Scene({
triggerElement: "#pinContainer",
triggerHook: "onLeave",
duration: "300%"
})
.setPin("#pinContainer")
.setTween(wipeAnimation)
.addIndicators() // add indicators (requires plugin)
.addTo(controller);
});
也许有人可以帮助我.. 谢谢!
【问题讨论】:
标签: javascript jquery html scrollmagic