function FadeOutIn(qel, qtext, ael, atext) {
$(qel, ael).animate({
opacity: 0.0
}, 1000, function() {
PopQuestion(qel, qtext), PopAnswers(ael, atext);
$(qel, ael).animate({
opacity: 1.0
}, 1000, function() {
});
});
}
如果我删除 PopAnswers 函数及其关联的参数,它在 PopQuestion 上效果很好。我希望同时在 2 个 Pop 函数上运行动画。
最佳答案
不要用逗号分隔函数调用,而是使用 ;
function FadeOutIn(qel, qtext, ael, atext) {
$(qel, ael).animate({
opacity: 0.0
}, 1000, function() {
PopQuestion(qel, qtext);
PopAnswers(ael, atext);
$(qel, ael).animate({
opacity: 1.0
}, 1000, function() {
});
});
}
浏览器控制台/开发工具 (F12) 应向您显示此时存在语法错误
关于javascript - 是否可以将 2 个函数传递给 .animates 完整参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28770933/