title: Offset top document.querySelector - Javascript
body: <p>I use the following code to use smooth scroll when clicking a link with anchor.
  This works perfect but I need to add some offset top of 88 pixels, because of a static header.</p>
  
  <p>How can I extend this code and add a off set top of 88px?</p>
  
  <p>Code:</p>
  
  <pre><code>&lt;script type="text/javascript" &gt;
  document.querySelectorAll('a[href^="#"]').forEach(anchor =&gt; {
      anchor.addEventListener('click', function (e) {
          e.preventDefault();
  
          document.querySelector(this.getAttribute('href')).scrollIntoView({
              behavior: 'smooth'
          });
      });
  });
  &lt;/script&gt;
  </code></pre>