I have a parallax/animation page where I pin an element for the duration of its container. I also override the natural mouse scroll behavior with function:
function smoothScroll() {
var $window = $(window);
var scrollTime = 1;
var scrollDistance = 400;
$window.on("mousewheel DOMMouseScroll", function (event) {
event.preventDefault();
var delta = event.originalEvent.wheelDelta / 120 || - event.originalEvent.detail / 3;
var scrollTop = $window.scrollTop();
var finalScroll = scrollTop - parseInt(delta * scrollDistance);
TweenMax.to($window, scrollTime, {
scrollTo: { y: finalScroll, autoKill: true },
ease: Power1.easeOut,
overwrite: 5
});
});
}
This seem to cause my pinned element to be choppy and lagg behind, I suspect the reason is that scrollMagic updates the position of my pinned element again before the unnatural scrolling is complete (without my smoothscroll the pinend element scrolls smooth).
I have googled and read scrollmagic documentation but am still clueless how to make it smooth. Any ideas?
Edit:
Here are two fiddles showing the problem:
No choppy plane but no smooth scroll -> http://codepen.io/anon/pen/azexRm
Choppy plane + smooth scrolling -> http://codepen.io/anon/pen/wBVZYQ