Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery callback after slideUp

Tags:

jquery

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.

Thanks.

like image 297
frenchie Avatar asked Jun 05 '12 13:06

frenchie


2 Answers

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

$(".SomeDiv").slideUp(400, function() {
    // Animation complete.
    SomeFunction();
});
like image 123
VisioN Avatar answered Nov 02 '22 21:11

VisioN


In fact you can just simply use:

$(".SomeDiv").slideUp(400, CallBackFunction);
like image 21
user3669859 Avatar answered Nov 02 '22 20:11

user3669859