TheEagle Posted November 8, 2013 Report Share Posted November 8, 2013 Hi I'm trying to make an infinite animate (loop).So I call the same function as a callback function.It works but I observed when the callback function is called (which is the same function) it takes some time.Is there any better way or a solution for that delay? Following is the code I use: $(document).ready(function () { scroll(); }); function scroll() { $("#divtomove").css("left", "-150px"); $("#divtomove").animate({ left: "300px" }, 20000, scroll); } Quote Link to comment Share on other sites More sharing options...
TheEagle Posted November 8, 2013 Author Report Share Posted November 8, 2013 Hi I'm trying to make an infinite animate (loop).So I call the same function as a callback function.It works but I observed when the callback function is called (which is the same function) it takes some time.Is there any better way or a solution for that delay? Following is the code I use: $(document).ready(function () { scroll(); }); function scroll() { $("#divtomove").css("left", "-150px"); $("#divtomove").animate({ left: "300px" }, 20000, scroll); } I found the Div size was bigger than I thought so part of the delay was not real(sorry).A little part which looks real is at the end of the animation (before calling the callback function)the animation becomes abit slow but it is not important... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.