title: window.onresize: firing a function during, and when resizing is complete
body: <p>I'm new to JavaScript. I am trying to figure out how I would create an onresize function to fire a function during and another one after the user is done resizing the window. Most likely a session timeout will occur.</p>
  
  <p>Any ideas on writing a basic function?</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      window.onresize = function () {
      // The first function goes here while resizing is happening
      // Then function 2 occurs when window resizing is finished by the user
      }    
  &lt;/script&gt;
  </code></pre>
  
  <p>Here is the modified version of what I am attempting. The goal is to hide the main capsule div on a page while the page is resizing. Initially when the onresize event is triggered is turns on a div's visibility to be a stand by screen saying "please wait while we process the information".</p>
  
  <p>The Script Exp:</p>
  
  <pre><code>var resizeTimeout;
  window.onresize = function() {
          clearTimeout(resizeTimeout);
           document.getElementById("loading").className = "loading-visible";
           document.getElementById('XXXDIV').style.visibility = 'hidden';
               for ( var h = 1; h &lt; 40; h++)
                   {
                   document.getElementById('DesignXXX' + h ).style.visibility = 'hidden';
                   }
      resizeTimeout = setTimeout(function() {
              var hideDiv = function(){document.getElementById("loading").className = "loading-invisible";};
              var oldLoad = window.onload;
              var newLoad = oldLoad ? function(){hideDiv.call(this);oldLoad.call(this);} : hideDiv;
              location.reload(true) = newLoad;
              document.getElementById('XXXDIV').style.visibility = 'visible';
               for ( var h = 1; h &lt; 40; h++)
                   {
                   document.getElementById('DesignXXX' + h ).style.visibility = 'visible';
                   }
      }, 2000); // set for 1/4 second.  May need to be adjusted.
  };
  
  &lt;/script&gt;
  </code></pre>