GalloPinto
GalloPinto

Reputation: 677

queue: false not working on jQuery animate when using a function

I'm using jquery animate function to animate a DIV. But I want to avoid a queue when clicking a lot of times on it. When i use queue: false and add a function, the function just don't work. I don't really know why. If I remove the function, it works, but i need the function and the queue false at the same time.

This is my Javascript

 $("#details-kpi-container").animate({ height: "295px" }, {queue: false }, function () {
    funcion_a_ejecutar();
});

Upvotes: 2

Views: 1757

Answers (1)

gen_Eric
gen_Eric

Reputation: 227290

Your syntax isn't correct. Check the docs: http://api.jquery.com/animate/

If you are passing an options object, you need to include the callback in that object.

$("#details-kpi-container").animate({height: "295px"}, {
    queue: false,
    complete: function () {
        funcion_a_ejecutar();
    }
});

Upvotes: 3

Related Questions