title: How to do scrollTop and toggleClass with Javascript and not jQuery?
body: <p>In <strong>jQuery</strong> you can use method <code>toggleClass</code> and <code>scrollTop</code> but I´m trying to figure out how to do this with javascript.</p>
  
  <p>I have a fixed <code>&lt;header&gt;</code> menu that I´m resizing when you scroll the window. So I want to add <code>class="small"</code> to the header with the help of javascript.</p>
  
  <p>I have figured out the <strong>jQuery</strong> code:</p>
  
  <pre><code>$(document).on("scroll", function () {
      $("header").toggleClass("small", $(document).scrollTop() &gt; 100);
  });
  </code></pre>
  
  <p>But I want to write this in javascript.
  Below is what I´ve tried with so far but I´m stuck, any help appriciated:</p>
  
  <pre><code>function toggleMenu() {
      var body = document.getElementsByTagName(body);
      if (body &gt; 100) {
          document.getElementsByTagName('header').classList.toggle('small');
      }
  }
  </code></pre>