title: JS scrolling back to top after window.scroll
body: <p>Hihi, I need that when I visit my webpage and # is present in the url go to that section.
  So What I did is to add an JS script</p>
  <pre><code>document.addEventListener('DOMContentLoaded', () =&gt; {
      // setupScrolling();
      setupTitle();
      if (window.location.hash) {
          const element = document.getElementById(window.location.hash);
          if (element) {
              const offset = element.offsetTop;
              const a = offset - (document.querySelector('header')?.offsetHeight);
              window.scroll({
                  top: offset,
                  behavior: 'smooth'
              });
              return false;
          }
      }
  });
  </code></pre>
  <p>This is the script I added into my public/index.html</p>
  <p>But, the behavior isn't correct..
  Once the page scroll down to the section it will automatically go back to the top of the site and I don't know why.</p>
  <p>Can anyone help me and tell me what I should do?</p>