TheEagle Posted November 8, 2013 Report 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); }
TheEagle Posted November 8, 2013 Author Report 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...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now