Open henrikrosendalvonessen opened 7 years ago
Easiest would be like this:
$(document).ready(function(){
var prevIndex = 1;
$(".main").onepage_scroll({
sectionContainer: "section",
responsiveFallback: 600,
loop: true,
afterMove: function(index) {
if (prevIndex<index) {
// move next page
console.debug("next > afterMove("+index+") prvIdx:"+prevIndex);
} else {
// move prev page
console.debug("prev > afterMove("+index+") prvIdx:"+prevIndex);
}
prevIndex = index; //at the very end of afterMove method
}
});
});
I need to know the scroll direction, and be able to use this information in the "beforeMove" function, because I'm animating an element based on the scroll direction. Placing my animation in the "afterMove" function, creates way too big of a delay, while waiting for the scroll transition to end.
Anyone figured out how to accomplish this yet?