Note that there are some explanatory texts on larger screens.

plurals
  1. POStop animation stops working, jQuery/hover
    primarykey
    data
    text
    <p>I am using jQuery to animate the background colors of 3 different divs, repeated to make a 3x3 grid. All's well except the hover out/stop animation seems to quit working if the hover time is extended past a second. </p> <p>If you hover for one second and move out, the colors freeze in place as desired. However, hovering an extended amount of time seems to break the hover-out/stop function.</p> <p>Can someone help to explain how the hover/stop function works when trying to control multiple functions simultaneously? </p> <p>As the only way to show working jQuery is via JSfiddle, I've linked to the a working example here: <a href="http://jsfiddle.net/Commandrea/KbLDq/3/" rel="nofollow">http://jsfiddle.net/Commandrea/KbLDq/3/</a></p> <pre><code> function pixelColors(){ var color = '#'+(Math.random()*0xFFFFFF&lt;&lt;0).toString(16); $('.logo').animate({ backgroundColor: color }, 1000, pixelColors); } function pixelColors2(){ var color = '#'+(Math.random()*0xFFFFFF&lt;&lt;0).toString(16); $('.logo2').animate({ backgroundColor: color }, 2000, pixelColors2); } function pixelColors3(){ var color = '#'+(Math.random()*0xFFFFFF&lt;&lt;0).toString(16); $('.logo3').animate({ backgroundColor: color }, 1500, pixelColors3); } $('#logo_back').hover( pixelColors, function() { $('.logo').stop() } ); $('#logo_back').hover( pixelColors2, function() { $('.logo2').stop() } ); $('#logo_back').hover( pixelColors3, function() { $('.logo3').stop() } ); .header { position: relative; margin: 0 auto; } #home_header { position: relative; z-index: 7; } .pixCol { float: left; height: 288px; margin-right: 20px; margin-top: 12px; min-height: 1px; padding-left: 15px; width: 227px; } #pixelBox { left: 14px; position: relative; top: 20px; } .logo { height: 69px; width: 69px; z-index: 8; background-color:#9C3; display:inline-block; float:left; background-color:#F60; } .logo2 { height: 69px; width: 69px; z-index: 8; background-color:#9C3; display:inline-block; float:left; background-color:#F90; } .logo3 { height: 69px; width: 69px; z-index: 8; background-color:#9C3; display:inline-block; float:left; background-color:#F33; } .logo_back{ background:none; height: 220px; margin-top: 51px; position: absolute; width: 229px; z-index: 9; } .logo_back2 { background: url("images/logo/batterEmpty.png") no-repeat scroll 0 0 transparent; height: 220px; margin-top: 51px; position: absolute; width: 229px; z-index: 9; } ​ &lt;div class="header"&gt; &lt;div class="pixCol"&gt; &lt;div id="home_header"&gt; &lt;div id="logo_back" class="logo_back"&gt;&lt;/div&gt; &lt;div id="pixelBox"&gt; &lt;div class="logo"&gt;&lt;/div&gt; &lt;div class="logo2"&gt;&lt;/div&gt; &lt;div class="logo3"&gt;&lt;/div&gt; &lt;div class="logo3"&gt;&lt;/div&gt; &lt;div class="logo"&gt;&lt;/div&gt; &lt;div class="logo2"&gt;&lt;/div&gt; &lt;div class="logo2"&gt;&lt;/div&gt; &lt;div class="logo3"&gt;&lt;/div&gt; &lt;div class="logo"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; ​ </code></pre>
    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.
 

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