const blocks = document.querySelectorAll('.block');
const scrollTo = (delta) => {
for (let i = 0; i < blocks.length; i++) {
const elem = blocks[i];
elem.classList.remove('active');
if (i == delta) {
elem.classList.add('active');
}
}
}
let step = 0;
document.addEventListener('wheel', (e) => {
if (e.deltaY < 0) {
step -= 1;
if (step <= 0) { step = 0}
}
if (e.deltaY > 0) {
step += 1;
if (step >= 5) { step = 4 }
}
console.log(step);
scrollTo(step);
});