title: Remove window "resize" listener
body: <p>This question relates closely to the stack overflow question &quot;<a href="https://stackoverflow.com/questions/1852751/window-resize-event-firing-in-internet-explorer">window.resize event firing in Internet Explorer</a>&quot;.</p>
  <p><strong>The Issue:</strong>
  I am attempting to fix a resizing issue in Internet Explorer 8. Currently, the resize function gets called repeatedly causing IE to essentially lock up - the user can no longer use buttons that call Javascript actions.</p>
  <p><strong>Previous Attempt(s):</strong></p>
  <pre><code>var resizeTimeout;
  var resizeHandler = function() {
      clearTimeout(resizeTimeout);
      //$(window).unbind('resize', resizeHandler);
      //window.removeEventListener('resize');
      window.removeEventListener('resize', resizeHandler, false);
      scrollHandler();
      setTimeout(&quot;$(window).resize(resizeHandler);&quot;, 100);
      return true;
  }
  //$(window).resize(resizeHandler);
  window.addEventListener('resize', resizeHandler, false);
  </code></pre>
  <p><strong>Problems:</strong> It appears that <code>window</code> cannot implement <code>addEventListener</code> or <code>removeEventListener</code> and unbinding jQuery doesn't stop IE from continuing to freak out. It works fine in all other browsers.</p>
  <p><strong>Desired Behavior:</strong> The goal here is really to get IE to stop repetitively executing code so other functions like <code>onclick</code> events work.</p>
  <hr />
  <p>Does anyone know how I can remove the resize event after it's been added or simply make IE stop being retarded. (&lt;-- Extra points if you can make IE not be retarded.)</p>
  <hr />
  <p><strong>Resolution:</strong> Inside of the <code>scrollHandler</code> function a variable was not declared using the <code>var</code> prefix. Adding var made all the evil fairies go away.</p>