title: jQuery - call function on resize AND after clicking a button
body: <p>I want to call a function only <strong>If the window size <code>&lt; 767</code> (should work with resizing) AND after clicking a button</strong></p>
  
  <p>This code I have works perfectly if I make the window size <code>&lt; 767</code> and click search. BUT, it doesnt work if I click the button on window size <code>&gt; 767</code> and <code>RESIZE</code> to <code>&lt; 767</code>. I'm looking for a way to combine all <code>&lt;767</code> and <code>resize</code> and button click?  </p>
  
  <p>This is what I have so far. Can you guys please help?</p>
  
  <pre><code>function searchButtonClick(){
  
      if(jQuery(window).width() &lt; 767){
          jQuery('.search_mob').slideUp(500);
          jQuery('.carousel-wrapper').hide(); //show search function
          jQuery('.innerSearhPopup').slideUp(300); //show search function
  
          if (jQuery('.carousel-wrapper').css('display') == 'none')
              {
                 jQuery('.innerSearhPopup').css({'top':'109px' });
              }
  
          }
  }
  </code></pre>