USer22999299
USer22999299

Reputation: 5674

How to wait until hide effect is ended in jquery

Found few solution in here but non of them is the same as mine problems:

$('.listed-Item-Table').not(spesificItem).fadeTo('fast',0.2).hide(1000);

I got around 20 objects that are been hide. After this hiding effect i ended i was to add some object into the DOM and show them.

while doing the following:

    $('.listed-Item-Table').not(spesificItem).fadeTo('fast',0.2).hide(1000 , 
      function(){
        addDetilsBox(spesificItem);
     });

I do add the object only after the hiding effect is done , but i'm adding him 20 times.

How should i wait until the hiding effect is over for all of the 20 items and only then add 1 object to the DOM?

Upvotes: 2

Views: 753

Answers (1)

Balachandran
Balachandran

Reputation: 9637

use promise().done() in jquery

$('.listed-Item-Table').not(spesificItem).fadeTo('fast',0.2).promise().done(function(){

// call back code
});

Upvotes: 4

Related Questions