Reputation: 171
I try use Scrolltomagic to scroll section when trigger is activated.
var sceneOptions2 = {duration: 500};
var divfocus = $("div.wrapper section");
when the section is activated it should go up to the top of the page. But scrolling donts works.
new ScrollScene(sceneOptions2)
.addTo(controller)
.triggerHook("onCenter")
.triggerElement(divfocus[1])
.setTween(TweenMax.to(divfocus[1], 2, {scrollTo:{y:50}, ease:Back.easeOut}));
How can make the section go to top when it is activated by the trigger?
complete code: http://jsfiddle.net/thallysondias/14ktjsb7/4/
ps: Any suggestion for optmize my code, maybe a clean way
Upvotes: 0
Views: 998
Reputation: 2027
ScrollMagic is a scroll interaction plugin, not a scroll jacking plugin.
To force breaks in scroll position use fullPage or OnePageScroll.
Full answer here: https://github.com/janpaepke/ScrollMagic/issues/234
Upvotes: 1