Jquery 需要2个功能之间的延迟,每个功能都设置了超时

Jquery 需要2个功能之间的延迟,每个功能都设置了超时,jquery,animation,delay,settimeout,intervals,Jquery,Animation,Delay,Settimeout,Intervals,我有两个函数abc()和def()。两者都有设置超时功能。它们是从父函数xyz()调用的。最初应调用abc(),然后应调用abc animation def()功能。问题:两个函数一个接一个地调用,但它们之间没有延迟。两个settimeout同时工作。请帮忙。提前谢谢 function abc() { // there is settimeout function //cleartimeout after some time } function def() { //

我有两个函数abc()和def()。两者都有设置超时功能。它们是从父函数xyz()调用的。最初应调用abc(),然后应调用abc animation def()功能。问题:两个函数一个接一个地调用,但它们之间没有延迟。两个settimeout同时工作。请帮忙。提前谢谢

function abc() {
    // there is settimeout function
    //cleartimeout after some time 
}

function def() {
    // there is settimeout function
    //cleartimeout after some time 
}

function xyz() {
    abc(); // i need a delay between each settimeout functionality. 
    def(); //currently both run together.
}

一种解决方案是在
xyz()

如果
def()
总是在
abc()
之后,那么您可以让
xyz()
只需调用
abc()
,在
abc()
中,您可以在动画完成后调用
def()
,但我们需要查看
abc()
=)的代码

function abc() {
    // Leave this alone, no need for setTimeout in here
}

function def() {
    // Leave this alone, no need for setTimeout in here
}

function xyz() {
    abc(); // i need a delay between each setTimeout functionality. 
    setTimeout(def, 500);
}