Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript - Remove window "resize" listener
    primarykey
    data
    text
    <p>This question relates closely to the stack overflow question "<a href="https://stackoverflow.com/questions/1852751/window-resize-event-firing-in-internet-explorer">window.resize event firing in Internet Explorer</a>".</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("$(window).resize(resizeHandler);", 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>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload