How do i run the .animate function in jQuery forever?
ajax, animation, jquery, jquery-1.3.2
Solution
You have the parameters to animate wrong. It doesn't take an options hash, just the actual options for easing, duration, and a callback. Also, you need to take care when using `this`. Better to pass it in as an argument to the endless function.
$(this).css("left","100px");
function endless(elem){
$(elem).animate(
{ left:'-=100px' },
"linear",
5000,
function() {
$(elem).css('left','100px');
endless(elem);
}
);
};
endless(this);
Problem
``` $(this).css("left","100px"); function endless(){ $(this).animate({ left:'-=100px', },{ easing: "linear", duration: 5000, complete: function() { $(this).css('left','100px'); endless(); } }); }; endless(); ``` This is what I tried, but using this approach i can't get stuff moving. Im' using jQuery 1.3.2. Any Suggestions?