Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery animation slow down after call stop and restart
    text
    copied!<p>I have defined a function to animate 7 divs to the top. I tried to using stop(true, false) function to stop all the element. and restart the animation by calling the function again. please see the code below. the problem is the animation became very slow after I call the function to restart the animation. it slows for a few seconds and become normal speed again. does anyone know the reason. please help!!! Thanks</p> <p>my code is attach below</p> <pre><code>autoAnimate(5000); $('#scroller_container').mouseenter(function(){ $('#scroller .galleryThumb').stop(true, false); }); $('#scroller_container').mouseleave(function(){ autoAnimate(5000); }); function autoAnimate(speed) { $('#scroller .galleryThumb:eq(0)') .animate({'top':'-122px'},speed,'linear',function(){ if(!autoFlag) { index = $('#scroller .galleryThumb:last').attr('id'); index = index.substr(5, index.length); index = parseInt(index); index = index + 1; autoFlag = true; } if(index == numberOfAds) { index = 0; } $('#scroller .galleryThumb:eq(0)').remove(); $('#scroller').append(adUnitContainer[index]); $('#scroller .galleryThumb:eq(6)').css('top','732px'); index++; autoAnimate(speed); }); $('#scroller .galleryThumb:eq(1)').animate({'top':'0px'},speed,'linear'); $('#scroller .galleryThumb:eq(2)').animate({'top':'122px'},speed,'linear'); $('#scroller .galleryThumb:eq(3)').animate({'top':'244px'},speed,'linear'); $('#scroller .galleryThumb:eq(4)').animate({'top':'366px'},speed,'linear'); $('#scroller .galleryThumb:eq(5)').animate({'top':'488px'},speed,'linear'); $('#scroller .galleryThumb:eq(6)').animate({'top':'610px'},speed,'linear'); } </code></pre>
 

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