我敢肯定,前几天我读到了这件事,但似乎找不到任何地方。
我有一个fadeOut()
事件,之后我删除了该元素,但是jQuery在有机会完成淡出之前删除了该元素。
如何让jQuery等待元素淡出,然后将其删除?
最佳答案
您可以指定一个回调函数:
$(selector).fadeOut('slow', function() {
// will be called when the element finishes fading out
// if selector matches multiple elements it will be called once for each
});
Documentation here。
关于jquery - 如何让jQuery等待效果完成?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/1065806/