frenchie
frenchie

Reputation: 52047

jQuery callback after slideUp

I have this code:

$('.SomeDiv').slideUp(400);
setTimeout(function () { SomeFunction(); }, 400);

How do I rewrite this and remove the setTimeout so that SomeFunction becomes a call-back function of slideUp.

Upvotes: 17

Views: 21942

Answers (2)

user3669859
user3669859

Reputation: 61

In fact you can just simply use:

$(".SomeDiv").slideUp(400, CallBackFunction);

Upvotes: 5

VisioN
VisioN

Reputation: 145478

Method slideUp() has callback argument. So you can do it easily with:

$(".SomeDiv").slideUp(400, function() {
    // Animation complete.
    SomeFunction();
});

Upvotes: 45

Related Questions