javascript - jquery .animate is not working -


i have jsfiddle :http://jsfiddle.net/2mrmr/3/

this code not working :

setinterval(function () {         box.animate({             left: function (i, v) { return newv(v, 37, 39); },             top: function (i, v) { return newv(v, 38, 40); }         });      }, 20); 

while :

setinterval(function () {         box.css({             left: function (i, v) { return newv(v, 37, 39); },             top: function (i, v) { return newv(v, 38, 40); }         });      }, 20); 

any please ?

as adeneo said - using setinterval create own animation don't need jquery animate() inside. animate() use setinterval make animation. modify left , top using setinterval , newv() , animate() try modify left , top using own setinterval @ same time.

btw: in animate() can use step() modify value in every step (without own setinterval) never used it.


Comments