var start = $('#start_img');
start.on('click', function(){
var piano = $('.piano');
piano.each(function(index){
$(this).hide().delay(700 * index).fadeIn(700*index);
start.off('click');
})
});
機能jqueryのを停止します。しかし、事実は、私はイベントが実行されている間にイベントリスナーをオフにしたいだけです。イベントがまだ実行されている間は、再度呼び出すことはできません。しかし、イベントが終了すると、私はそれが再び '呼び出し可能'になりたい。誰がどのようにこれを行うか知っていますか?は一時的にあなたは、私が<strong>start.off(「クリック」)が呼ばれた後、再び実行しているからイベントリスナーを停止するには、</strong>メソッドを使用していることがわかります
これ以外のやり方(どちらも動作しません)。誰でも私をここで助けることができますか?もう1つは現在クリアです。
var start = $('#start_img');
start.on('click', function() {
var q = 0;
var piano = $('.piano');
if (q === 1) {
return; // don't do animations
}
else{
piano.each(function(index) {
q = 1;
$(this).hide()
.delay(700 * index)
.fadeIn(700 * index, function() {
// remove from each instance when animation completes
q = 0
});
});}
});
までfadeInが完了しました – user7548524