title: How to stop an off-canvas menu from animating on browser resize
body: <p>I have an off canvas menu demo here:</p>
  
  <p><a href="http://jsfiddle.net/davidpauljunior/a52btffa/" rel="nofollow">jsfiddle</a></p>
  
  <p>The toggle button itself works as expected (menu slides in and out) but the problem is that when the menu is 'off', if you resize the browser from wide to narrow, you'll see the menu animate.</p>
  
  <p>The JS just toggles a class on the HTML element.  CSS transitions and transforms do the moving and animation of the menu.  It's because that menu has a transition on it so it's animating moving it off the screen for the smaller screen size.  I want the transition when you click the toggle button, but I don't want it just when the browser is resized.</p>
  
  <p>Note that I don't want to use JS for the animation.</p>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>&lt;header class="Header" role="banner"&gt;
      &lt;div class="GlobalLogo"&gt;&lt;/div&gt;
      &lt;button class="GlobalNavToggle js-globalNavToggle" type="button"&gt;Toggle navigation&lt;/button&gt;
      &lt;nav class="GlobalNav"&gt;
          &lt;!--&lt;h2 class="u-srOnly"&gt;Main Menu&lt;/h2&gt;--&gt;
          &lt;ul class="GlobalNav_list"&gt;
              &lt;li class="GlobalNav_item"&gt;
                  &lt;a class="GlobalNav_link" href="#"&gt;Top level 1&lt;/a&gt;
              &lt;/li&gt;
              &lt;li class="GlobalNav_item"&gt;
                  &lt;a class="GlobalNav_link" href="#"&gt;Top level 2&lt;/a&gt;
              &lt;/li&gt;
              &lt;li class="GlobalNav_item"&gt;
                  &lt;a class="GlobalNav_link" href="#"&gt;Top level 3&lt;/a&gt;
              &lt;/li&gt;
              &lt;li class="GlobalNav_item"&gt;
                  &lt;a class="GlobalNav_link" href="#"&gt;Top level 4&lt;/a&gt;
              &lt;/li&gt;
              &lt;li class="GlobalNav_item"&gt;
                  &lt;a class="GlobalNav_link" href="#"&gt;Top level 5&lt;/a&gt;
              &lt;/li&gt;
          &lt;/ul&gt;
      &lt;/nav&gt;
  &lt;/header&gt;
  &lt;div class="Main clearfix" role="Main"&gt;
      &lt;p&gt;...&lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>SCSS:</strong></p>
  
  <pre><code>body {
      margin: 0;
      .isActiveGlobalNav &amp; {
          overflow: hidden;
      }
  }
  
  .clearfix:before,
  .clearfix:after {
      content: " "; /* 1 */
      display: table; /* 2 */
  }
  
  .clearfix:after {
      clear: both;
  }
  
  .Container {
      max-width: 900px;
  }
  
  .Main {
      clear: both;
      margin-top: 30px;
  }
  
  .GlobalLogo {
      float: left;
      margin-right: 20px;
      background-size: 100%;
      background-image: url('http://placehold.it/100x35');
      background-repeat: no-repeat;
      width: 100px;
      height: 35px;
  }
  
  .GlobalNav {
      clear: both;
      @media only screen and (max-width : 600px) {
          width: 70%;
          transform: translate3d(-100%, 0, 0);
          position: absolute;
          background: rgba(0,0,0,.9);
          top: 0;
          bottom: 0;
          left: 0;
          right: 0;
          transition: transform .25s ease-in;
  
          .isActiveGlobalNav &amp; {
              transform: translate3d(0, 0, 0);
          }
      }
      @media only screen and (min-width : 601px) {
          clear: none;
          float: left;
      }
  }
  .GlobalNav_list {
      list-style: none;
      padding: 0;
      margin: 0;
  }
  .GlobalNav_item {
      @media only screen and (min-width : 601px) {
          float: left;
      }
  }
  .GlobalNav_link {
      padding: 10px;
      display: block;
      color: white;
      text-decoration: none;
      @media only screen and (min-width : 601px) {
          color: black;
      }
  }
  
  .GlobalNavToggle {
      float: right;
      margin-top: 7px;
      line-height: 20px;
      background: yellow;
      border: none;
      cursor: pointer;
      @media only screen and (min-width : 601px) {
          display: none;
      }
  }
  </code></pre>
  
  <p><strong>JS</strong></p>
  
  <pre><code>var navigation = function () {
  
      var $html = $('html'),
          //$globalNav = $('GlobalNav'),
          $globalNavToggle = $('.js-globalNavToggle');
  
      $globalNavToggle.on('touchstart click', function () {
  
          $html.toggleClass('isActiveGlobalNav');
  
      });
  
  };
  
  navigation();
  </code></pre>