Jump to content
Killersites Community
Sign in to follow this  
TheEagle

Infinite Animate Is Late

Recommended Posts

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);

}

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×