I have question about how scrollIntoView is working, so why scrollIntoView working like this:
liItems.forEach(val => {
val.addEventListener('click', e => {
e.preventDefault();
document.querySelector(val.getAttribute('href')).scrollIntoView({
...
})
})
})
But not working like this:
liItems.forEach(val => {
val.addEventListener('click', e => {
e.preventDefault();
val.getAttribute('href').scrollIntoView({
...
})
})
})