简体   繁体   English

如何等待直到jquery中的隐藏效果结束

[英]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. 我得到了大约20个被隐藏的物体。 After this hiding effect i ended i was to add some object into the DOM and show them. 在这种隐藏效果之后,我结束了我要向DOM添加一些对象并显示它们的过程。

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. 我仅在完成隐藏效果后才添加对象,但是我将其添加了20次。

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 ? 我应该如何等到20个项目的全部隐藏效果都结束,然后才向DOM添加1个对象?

use promise().done() in jquery 在jQuery中使用promise()。done()

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

// call back code
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM