Note that there are some explanatory texts on larger screens.

plurals
  1. POJavaScript not working in IE, .data? setInterval?
    text
    copied!<p>I've developed the following code which simply swaps one image for another every x-seconds. All works fine and returns no errors in Chrome. However, in IE (latest back to IE8) it simply does nothing, returns no errors, just stays on the first image.</p> <p>Any advice? I remember reading somewhere that setInterval can cause issues in IE.</p> <p>Consider:</p> <pre><code>$(function () { var fElement = $('.fadein'); fElement.find('img:gt(0)').hide(); setInterval(function () { if (!fElement.data('paused')) { fElement.find(':first-child') .stop(true, true) // fixes le tabbed/hidden animation queue .fadeOut() .next('img') .fadeIn() .end() .appendTo('.fadein'); } else { console.log('waiting...'); } }, 2000); $('map').hover( function () { console.log('pausing'); fElement.data('paused', 1); }, function () { console.log('unpausing'); fElement.data('paused', 0); } ); }); if (!console &amp;&amp; !console.log) { console = {}; console.log = function () {}; } </code></pre> <p>and the CSS:</p> <pre><code>.fadein { display: block; height: 49px; width: 287px; float: left; } .fadein img { position:absolute; } .stripContainer { display:block; height: 49px; } </code></pre> <p>and the HTML:</p> <pre><code>&lt;div class="fadein"&gt; &lt;img src="img1.jpg" border="0" width="287" height="49" alt="" style="" id="level2Menu"/&gt; &lt;img src="img2.jpg" border="0" width="287" height="49" alt="" style="" id="level2Menu"/&gt; &lt;/div&gt; &lt;div class="stripContainer"&gt; &lt;img src="img3.jpg" usemap="#secondM" border="0" width="385" height="49" alt="" style="float:left;" id="level2Menu"/&gt; &lt;img src="img4.jpg" usemap="#secondM" border="0" width="288" height="49" alt="" style="float:right;" id="level2Menu"/&gt; &lt;/div&gt; </code></pre> <p>EDIT: This fiddle shows it working AS IT SHOULD in Chrome: <a href="http://jsfiddle.net/8f5uU/" rel="nofollow">http://jsfiddle.net/8f5uU/</a></p>
 

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