【发布时间】:2012-09-13 07:46:35
【问题描述】:
我知道问题的标题令人困惑。这也让我很难找到解决方案。
假设我有这些代码,当 .animate() 选项是外部对象时,如何将参数传递给 complete 或 step?
var someObj = {
onComplete: function(e) {
console.log(e); // return undefined
},
onStep: function(e) {
console.log(e); // return undefined too
},
}
var optionObj = {
duration: 300,
easing: 'linear',
complete: someObj.onComplete(e), // this is not working
step: someObj.onStep(e) // this is not working
}
$('div').animate({width: "500px", height: "500px"}, optionObj);
【问题讨论】:
标签: javascript jquery parameter-passing