Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery - Jerky animation

I have a little animation that's running a bit jerky in all browsers. Is there something I'm doing wrong?

Here's my code: http://jsfiddle.net/iltdev/nN6cT/2/

like image 252
iltdev Avatar asked Dec 07 '25 05:12

iltdev


1 Answers

One thing you are doing wrong, is that you are firing new animations before the previous ones have finished for an element..

That is because you are using the timing plugin and firing the new animation on fixed intervals. Better to use the callback argument of the .animation() method and start a new animation after the previous has completed..

demo at http://jsfiddle.net/gaby/qaGyS/2/


Another thing, is that you are animating a very small distance over a long time (for that distance). For example you animating 10 pixels over a second .. this is slow and you can see the individual movements..

with faster animations at http://jsfiddle.net/gaby/qaGyS/1/

like image 169
Gabriele Petrioli Avatar answered Dec 08 '25 18:12

Gabriele Petrioli



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!