Overcoming recursive issue
I want to make a div of a star move slowly across the screen and then when it gets to other side repeat as if it was a star moving across a nights sky.
I use;
-
$(document).ready(function(){
animatestars();
});
function animatestars()
{
$('#stars').animate({left:"0px"}, 5000);
$('#stars').css("right","10px");
animatestars();
}
but of course jquery dumps out when it gets to the left of the page saying too much recursion (because im calling a function from within a function over and over), how can I get round this?