block.forEach((el) => {
const pos = el.getBoundingClientRect();
if (pos.top < window.innerHeight / 2 && pos.bottom > 0) {
history.pushState(null, null, `#${el.id}`);
} else {
history.pushState(null, null, '');
}
});