your onend callback is being executed immediately (with the ()'s). you
likely want:

$(...).animate({ props }, 2000, "linear", function(){
     scroll_list(h);
});

to pass an anonymous function that will execute later (2000ms).

Regards
Peter Higgins



On Mon, Oct 27, 2008 at 6:01 AM, gattu_marrudu <[EMAIL PROTECTED]> wrote:
>
> Hi, I am new to jQuery and I would like to create a simple animation
> of a div scrolling in an infinite loop. When the div scrolls to the
> top, it is shifted to the bottom and starts over.
>
> I based my function on one found on the jQuery API reference:
> http://docs.jquery.com/Effects/queue
>
>  $("#show").click(function () {
>      var n = $("div").queue("fx");
>      $("span").text("Queue length is: " + n.length);
>    });
>    function runIt() {
>      $("div").show("slow");
>      $("div").animate({left:'+=200'},2000);
>      $("div").slideToggle(1000);
>      $("div").slideToggle("fast");
>      $("div").animate({left:'-=200'},1500);
>      $("div").hide("slow");
>      $("div").show(1200);
>      $("div").slideUp("normal", runIt);
>    }
>    runIt();
>
> My code is:
>
>        function scroll_list(h) {
>                $("#sl1").marginTop = 0;
>                $("#sl1").animate( {marginTop: -h}, 20000, "linear",
> scroll_list(h));
>        }
>        h = $("#sl1").height();
>        scroll_list(h);
>
> On firebug I get a "Too much recursion" error.
> How come calling the same function as a callback works in the first
> but not in the second case?
>
> Thanks,
> Stefano
>

Reply via email to