JQuery animation callback called before animation ends

I am using slideDown animation to show some divs in a newly added row in a table:

$("div", newRow).slideDown(10000, UpdateHours(response.d.Hours));

however, the UpdateHours () function is called long before the div animation finishes. This causes me a problem because the updated clocks are then covered with sliding divs.

I made the slide very slow in order to better illustrate the problem.

+5
source share
2 answers

I think he is trying to pass the result of calling UpdateHours (response.d.Hours) as a callback function, which explains why it is called that. One solution would be to create an anonymous function that calls UpdateHours.

$("div", newRow).slideDown(10000, function () { UpdateHours(response.d.Hours) });

slideDown jQuery. http://docs.jquery.com/Effects/slideDown

+34

, :

$("div", newRow).slideDown(10000, function() { UpdateHours(response.d.Hours); });

, - , , UpdateHours

+6

All Articles