質問
top.on('click', function(){
anim.run();
});
アニメーション関数があり、なぜこのように呼び出せないのか疑問に思っていました
top.on('click', anim.run);
解決
top.on('click', function () { anim.run(); });
または
top.on('click', Y.bind(anim.run, anim));
他のヒント
run
関数を取得し、 animから呼び出していないため、2番目のケースでは
。 this
は anim
ではないため
例:
var a = {
b: function () {
return this.c;
},
c: 1
},
c = 2;
a.b() === 1;
var bMethod = a.b;
bMethod() === 2;
所属していません StackOverflow