You have options to animate incorrectly. It does not accept hash parameters, but only actual parameters for easing, duration, and callback. In addition, when using thisyou need to take care. It is better to pass it as an argument to an infinite function.
$(this).css("left","100px");
function endless(elem){
$(elem).animate(
{ left:'-=100px' },
"linear",
5000,
function() {
$(elem).css('left','100px');
endless(elem);
}
);
};
endless(this);
source
share