window.addEventListener("scroll", event => {
let fromTop = window.scrollY;
sectionBlock.forEach(block => {
let section = document.querySelector(block.hash);
if (
section.offsetTop <= fromTop &&
section.offsetTop + section.offsetHeight > fromTop
) {
block.classList.add("active");
} else {
block.classList.remove("active");
}
});
});