title: Enabling jQuery function only if above a certain window size
body: <p>I am trying to enable a jQuery function only if the screen width is above 960px but my code stops working completely when I use the window resize function. I am suspecting that the code is faulty.</p>
  
  <p>So my question is, how do I enable jQuery function only if the width is 960px or wider?
  I will try to explain better if you don't understand!</p>
  
  <p>Thanks in advance!</p>
  
  <p>jQuery</p>
  
  <pre><code>function window_resize(){
  if($(window).width() &gt; 960){
      $('li#portfolio').on('mouseenter', function() {
      $(this).find('#subNav').addClass('active').hide().stop(true,true).fadeIn(300);
      }).on('mouseleave', function() {
      $(this).find('#subNav').stop(true,true).fadeOut(300);
  });
  }
  </code></pre>