我知道,问题标题令人困惑。这也让我很难找到解决方案。
假设我有这些代码,我怎样才能将参数传递给.animate() 选项complete
或step
当 .animate() 选项是外部对象时?
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);