jquery.repeater中slideUp完成后如何执行下一段代码 [英] How to execute the next code only after the slideUp is complete in jquery.repeater

查看:51
本文介绍了jquery.repeater中slideUp完成后如何执行下一段代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是原始代码

$(this).slideUp(deleteElement);
itemRemove();

上面的代码在slideUp完成之前调用了itemRemove().所以我使用了如下回调函数

The above code calls itemRemove() before the slideUp is complete. So I used callback function as below

$(this).slideUp( deleteElement, function() {
    itemRemove();
});

但这会影响转发器的索引功能(不会像原始转发器一样减少转发器名称索引.

But this affects the indexing functionality of the repeater(does not decrement the repeater name indexes as the original repeater.

推荐答案

可能不是最好的方法,但我是这样解决问题的:

Probably not the best way, but this is how I solved my problem:

$(this).slideUp(deleteElement);
setTimeout(function(){ itemRemove(); }, 2000);

此代码有效,因为 slideUp 在 2 秒前完成.很想找到正确的方法,那就是在 SlideUp 完成后.

This code works because the slideUp is complete before 2 seconds. Would love to find the proper way tho, that is as soon as the slideUp is complete.

这篇关于jquery.repeater中slideUp完成后如何执行下一段代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆