More information about the Underscore mailing list

[_] jquery - animate, callback not firing

Piotr Bogdan ppbogdan at gmail.com
Thu Feb 10 13:55:48 GMT 2011

I might be missing something but from http://api.jquery.com/animate/
.animate has two function signatures:

.animate( properties, [ duration ], [ easing ], [ complete ] )

or

.animate( properties, options )

and your invocation doesn't match any of them as you pass the function
3 arguments. You either want to pass duration and easing explicitly as
the function arguments with callback as 4th or cram everything into
options hash (with 'complete' key mapped to the callback function).
But since you want to pass 'queue' argument as well the second
signature is probably what you want. I think..

Hope that makes sense.


On 10 February 2011 13:28, juan kennaugh <contact at jkennaugh.co.uk> wrote:
> Hi all
>
> I'm making an infinite carousel (that old chestnut) based on:
>
> http://web.enavu.com/tutorials/making-an-infinite-jquery-carousel/
>
> It animates but for some reason which I can't work out, the callback
> isn't working when the animation has finished
>
> I've put the alert in there to test and nothing happens.
>
> this is the animation upon clicking the 'previous' button...
>
>
>         $('#home-carousel-list').animate({'left' :
> left_indent},{queue:false, duration:500},function(){
>
>         $('#home-carousel-list li:first').before($('#home-carousel-list
> li:last'));
>
>         $('#home-carousel-list').css({'left' : '-525px'});
>
>         alert('animation done');
>
>         });
>
> got any ideas - cos it's doing my head in.
>
>
> Cheers
>
> Juan
>
>
> --
> underscore_ list info/archive -> http://www.under-score.org.uk/mailman/listinfo/underscore
>