My smoothscroll script works fine with other browsers. But I can't seem to make it work on Internet Explorer. Any thoughts?
let anchorLinks = document.querySelectorAll('a[href^="#"]')
let headerHeight = $('header').outerHeight();
for (let item of anchorLinks) {
item.addEventListener('click', (e) => {
let hashVal = item.getAttribute('href')
let topOfElement = document.querySelector(hashVal).offsetTop - headerHeight
window.scroll({ top: topOfElement, behavior: "smooth" })
history.pushState(null, null, hashVal)
e.preventDefault()
})
}