title: How to call a function on window resize
body: <p>I need to load a function on window resize while also taking effect at a certain breakpoint.  I'm using it to hide specific classes when viewed on a mobile sized screen.</p>
  
  <p>I've seen a couple of similar questions on here but I'm unsure how to combine them with my breakpoint code.</p>
  
  <pre><code>if($(window).width() &lt; 767)  {
      $('header#articles-insight nav').removeClass('collapsed');
      $('button.menu-toggle').removeClass('collapsed');
  }
  </code></pre>
  
  <p>This was the working code guys:</p>
  
  <pre><code>$(window).resize(function () {
      if ($(window).width() &lt; 767) {
         $('header#articles-insight nav').removeClass('collapsed');
         $('button.menu-toggle').removeClass('collapsed');
      }
  });
  </code></pre>