Jump to content

Infinite Animate Is Late


TheEagle

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

}

Link to comment
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...

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...