const scrollIntoViewWithOffset = (selector, offset) => {
window.scrollTo({
behavior: 'smooth',
top:
document.querySelector(selector).getBoundingClientRect().top -
document.body.getBoundingClientRect().top -
offset,
})
}
const anchors = document.querySelectorAll('a[href*="#"]')
for (let anchor of anchors) {
anchor.addEventListener("click", function(event) {
event.preventDefault();
const blockID = anchor.getAttribute('href')
scrollIntoViewWithOffset('' + blockID, 200)
})
}