Tengo un código location.href agregado para identificar la sección de la página que el usuario está viendo en la URL ( www.example.com/#section1 , www.example.com/#section2 etc.)
document.getElementById('link_no' + (i + 1)).classList.add('active-link'); let currentLocation = location.href; currLocationArray = currentLocation.split("#"); currentLocation = currLocationArray[0]; currentLocation += `#section${i+1}`; location.href = currentLocation; // scroll section let sectionOfI = document.getElementById(`section${i+1}`); let scrollArea = getOffset(sectionOfI); scrollEventNew(scrollArea.top,e);pero está arruinando el desplazamiento suave de mi función de desplazamiento construida por JS
function scrollEventNew(y , event) { window.scrollTo({ left: 0, top: y, behavior: 'smooth' }) } ¿Hay alguna manera de mantener ambos códigos sin comentar mi ubicación.href?
Tampoco puedo optar por un desplazamiento suave de CSS.