1//add smooth scrolling when clicking any anchor link
2document.querySelectorAll('a[href^="#"]').forEach(anchor => {
3 anchor.addEventListener('click', function (e) {
4 e.preventDefault();
5 document.querySelector(this.getAttribute('href')).scrollIntoView({
6 behavior: 'smooth'
7 });
8 });
9});
10//<a href="#someOtherElementID"> Go to Other Element Smoothly </a>