title: Change navbar color while scrolling
body: <p>I Just did that way with pure javascript to change navbar color after scrolling,
  it worked with google chrome without any problem
  but when I tried to test it at firefox
  it's not working with it.</p>
  
  <p>Anyone can give me any advice about this ?
  Thanks in advance. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var myNav = document.getElementById("nav");
  
  window.onscroll = function () {
      "use strict";
      if (document.body.scrollTop &gt;= 280) {
          myNav.classList.add("scroll");
      } else {
          myNav.classList.remove("scroll");
      }
  };</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>body {
    margin:0;
    padding:0;
    height:4000px;
    }
  .nav {
    position:fixed;
    width:100%;
    height:60px;
    background-color:#111;
    transition:all .5s ease-in-out;
    }
  .scroll {
    background-color:transparent;
    }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  
  &lt;div id="nav" class="nav"&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>