I'm using ScrollMagic
on my site and I want it to work like this MaterializeCSS Startup Theme
My problem is, that after the initial load the different containers are overlapping. After I scroll down completely and the up again, it works fine.
To understand what I mean, I created a Pen.
This is my 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);
});
Maybe someone can help me.. Thanks!