I'm trying to disable scroll counter after user scrolls up or down and while animation executing. I tried with timeouts but nothing worked. Timeout waited for 800ms with scrolling, but counter was still incerasing in the background.
I'm trying to achieve this functionality: https://alvarotrigo.com/fullPage/
My results so far: https://objemnarave.si/voda/index.php?lang=en
$('html').on('wheel', function(event) {
if (event.originalEvent.deltaY > 0) {
//scroll down
counter++;
//Check if counter is larger that section number, then execute animation
if (!(counter > maxSections)) {
$('html, body').animate({
scrollTop: $( $(".sect-"+counter) ).offset().top
}, 800);
}
} else {
//scroll up
counter--;
//Check if counter is smaller than previous section
if (!(counter < 1)) {
$('html, body').animate({
scrollTop: $( $(".sect-"+counter) ).offset().top
}, 800);
}
}
if (counter <= 0) {
counter = 1;
}
else if (counter >= 13) {
counter = maxSections;
}
console.log(counter);
});
It's possible to disable scroll counter in the backround while animation is executing?