Looping jQuery function/animation [SOLVED]
Hello,
New to jQuery and ran into what feels like it should be an easy to solve issue but I'm lost and can't seem to find an answer anywhere.
I have the folowing function:
-
function scroll_text(interval, element)
{
var element_width = $(element).outerWidth({ margin: true });
$(element).css("right", -element_width );
$(element).animate({right: element_width}, interval, 'linear');
}
I want to make this function repeat over and over again indefinitely but of course the next occurrence should only happen when the animation is finished. I thought I could do this through the callback ability but it doesn't appear that you can call back on the function currently being run.
Likewise using setTimeout and setInterval methods that I'm more familiar with don't seem to be working either...
Is there some obvious solution to this that I'm just not aware of? Any help would be immensely appreciated.
Jamie[/code]