Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does this simple JQuery Hover Effect work everywhere EXCEPT in IE7 thru IE9?
    primarykey
    data
    text
    <p>Being new to jQuery (but not vanilla JS) I am completely baffled why the following hover effect works in FF, Chrome, Safari, but not in IE! I got this script from one of Carl Meyer's post <a href="https://stackoverflow.com/questions/34536/how-do-you-swap-divs-on-mouseover-jquery">here</a>; changing only the object id's to match my markup.</p> <p>You can find a working example of this page <a href="http://www.databanque.com/jquery_test.htm" rel="nofollow noreferrer">here</a>, but here's the code:</p> <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;test&lt;/title&gt; &lt;script type="text/javascript" language="JavaScript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" language="JavaScript"&gt; $(document).ready(function() { toolButtons = $('#toolButtons &gt; li'); insideCenter = $('#insideCenter &gt; div'); toolButtons.each(function(idx) { $(this).data('slide', insideCenter.eq(idx)); }).hover( function() { toolButtons.removeClass('active'); insideCenter.removeClass('active'); $(this).addClass('active'); $(this).data('slide').addClass('active'); }); }); &lt;/script&gt; &lt;style type="text/css"&gt; #toolButtons .active { font-weight: bold; } #insideCenter div { display: none; } #insideCenter div.active { display: block; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;ul id="toolButtons"&gt; &lt;li class="active"&gt;First slide&lt;/li&gt; &lt;li&gt;Second slide&lt;/li&gt; &lt;li&gt;Third slide&lt;/li&gt; &lt;li&gt;Fourth slide&lt;/li&gt; &lt;/ul&gt; &lt;div id="insideCenter"&gt; &lt;div id="slide1" class="active"&gt;Well well.&lt;/div&gt; &lt;div id="slide2"&gt;Oh no!&lt;/div&gt; &lt;div id="slide3"&gt;You again?&lt;/div&gt; &lt;div id="slide4"&gt;I'm gone!&lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Any help is greatly appreciated!</p> <p>vinnie</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.
 

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