title: Add class to menu on hamburger click
body: <p>I have been going backwards and forwards.</p>
  
  <p>I am using <a href="https://jonsuh.com/hamburgers/" rel="nofollow">https://jonsuh.com/hamburgers/</a> for the mobile hamburger animations.</p>
  
  <p>The problem is, I click on the hamburger, the menu overlay opens. However, if you click the overlay it disappears without resetting the hamburger. The X remains.</p>
  
  <p>Second problem, and one that I have been trying to fix with jQuery. This is my first time using it, so bear with me.</p>
  
  <p>I have the menu fade in on scroll down, however, I have been trying to inject a 'remove' class, into the 'menu' class. So that I can set the CSS to display none. At the moment it is on top of the overlay and does not look good.</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>$(document).ready(function() {
  
    $(".hamburger").click(function() {
      $(".overlay").fadeToggle(200);
    });
  });
  
  $('.overlay').on('click', function() {
    $(".overlay").fadeToggle(200);
  
    open = false;
  });
  
  var $hamburger = $(".hamburger");
  $hamburger.on("click", function(e) {
    $hamburger.toggleClass("is-active"), $(".overlay").fadeToggle(200);
    // Do something else, like open / close menu
  });
  var $hamburger = $(".hamburger");
  $hamburger.on("click", function(e) {
    $hamburger.removeclass("is-active");
  
  });
  
  $(".hamburger").click(function() {
    $('#menu').addClass('remove');
  });
  
  $(".hamburger").click(function() {
    $('#menu').removeClass('');
  });
  
  (function($) {
    $(document).ready(function() {
      $(window).scroll(function() {
        if ($(this).scrollTop() &gt; 100) {
          $('#menu').fadeIn(500);
        } else {
          $('#menu').fadeOut(500);
        }
      });
    });
  })(jQuery);</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.hamburger {
    font: inherit;
    display: inline-block;
    overflow: visible;
    margin: 0;
    padding: 15px;
    cursor: pointer;
    transition-timing-function: linear;
    transition-duration: .15s;
    transition-property: opacity, -webkit-filter;
    transition-property: opacity, filter;
    transition-property: opacity, filter, -webkit-filter;
    text-transform: none;
    color: inherit;
    border: 0;
    background-color: transparent;
    position: absolute;
    z-index: 99999;
  }
  .hamburger:hover {
    opacity: .7
  }
  .hamburger-box {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 24px
  }
  .hamburger-inner {
    top: 50%;
    display: block;
    margin-top: -2px
  }
  .hamburger-inner,
  .hamburger-inner:after,
  .hamburger-inner:before {
    position: absolute;
    width: 40px;
    height: 4px;
    transition-timing-function: ease;
    transition-duration: .15s;
    transition-property: -webkit-transform;
    transition-property: transform;
    transition-property: transform, -webkit-transform;
    border-radius: 4px;
    background-color: #000
  }
  .hamburger-inner:after,
  .hamburger-inner:before {
    display: block;
    content: ''
  }
  .hamburger-inner:before {
    top: -10px
  }
  .hamburger-inner:after {
    bottom: -10px
  }
  .menu-overlay {
    position: fixed;
    background-color: transparent;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    transition: all 300ms ease-in-out
  }
  #menu {
    position: fixed;
    top: 0px;
    width: 100%;
    height: 65px;
    z-index: 4;
    display: none;
    background: red;
  }
  .menu {
    margin: 0
  }
  nav {
    text-align: center;
    display: inline-block;
    position: relative;
    height: auto;
    overflow: hidden;
    background: none;
    float: right
  }
  nav ul {
    text-align: center;
    margin: 0;
    padding: 0;
    text-decoration: none;
    list-style: none;
    float: right;
    margin: 0 .3rem 0
  }
  nav ul li {
    display: inline-block;
    letter-spacing: 3px;
    font-size: .5rem !important;
    font-family: "Montserrat", sans-serif;
    transition-property: all .2s linear 0s;
    -moz-transition: all .2s linear 0s;
    -webkit-transition: all .2s linear 0s;
    -o-transition: all .2s linear 0s;
    border-top: 3px solid transparent
  }
  nav ul li:hover {
    border-top: 3px solid #FFC3AF
  }
  nav ul li a {
    color: #2d2d2d;
    font-size: 16px;
    text-transform: uppercase;
    font-weight: 500;
    font-size: 13px;
    display: inline-block;
    display: inline-block;
    padding: 1.2rem 1.5rem;
    text-decoration: none;
    border-bottom: none
  }</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="menu"&gt;
    &lt;div class="hamburger hamburger--elastic" tabindex="0" aria-label="Menu" role="button" aria-controls="navigation"&gt;
      &lt;div class="hamburger-box"&gt;
        &lt;div class="hamburger-inner"&gt;&lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;nav class="nav-scroll"&gt;
      &lt;ul&gt;
        &lt;li&gt;&lt;a href="#home"&gt;Home&lt;/a&gt;
        &lt;/li&gt;
        &lt;li&gt;&lt;a href="#about"&gt;About&lt;/a&gt;
        &lt;/li&gt;
        &lt;li&gt;&lt;a href="#testimonials"&gt;Testimonials&lt;/a&gt;
        &lt;/li&gt;
        &lt;li&gt;&lt;a href="#portfolio"&gt;Portfolio&lt;/a&gt;
        &lt;/li&gt;
        &lt;li&gt;&lt;a href="#services"&gt;Services&lt;/a&gt;
        &lt;/li&gt;
        &lt;li&gt;&lt;a href="#contact"&gt;Contact&lt;/a&gt;
        &lt;/li&gt;
      &lt;/ul&gt;
    &lt;/nav&gt;
  &lt;/div&gt;
  &lt;div class="overlay" id="navigation"&gt;
    &lt;div class="wrap"&gt;
      &lt;ul class="wrap-nav"&gt;
        &lt;li&gt;&lt;a href="#home"&gt;Home&lt;/a&gt;
        &lt;/li&gt;
        &lt;li&gt;&lt;a href="#about"&gt;About&lt;/a&gt;
        &lt;/li&gt;
        &lt;li&gt;&lt;a href="#testimonials"&gt;Testimonials&lt;/a&gt;
        &lt;/li&gt;
        &lt;li&gt;&lt;a href="#portfolio"&gt;Portfolio&lt;/a&gt;
        &lt;/li&gt;
        &lt;li&gt;&lt;a href="#services"&gt;Services&lt;/a&gt;
        &lt;/li&gt;
        &lt;li&gt;&lt;a href="#contact"&gt;Contact&lt;/a&gt;
        &lt;/li&gt;
      &lt;/ul&gt;
    &lt;/div&gt;
    &lt;!-- end overlay - wrap --&gt;
  &lt;/div&gt;
  &lt;!-- end overlay --&gt;</code></pre>
  </div>
  </div>
  </p>