0

javascriptでタッチイベントを使用しようとしています。オブジェクトに mutiltouch イベントを追加したいのですが、後でそのイベントを簡単に削除できるので、1 つのタッチ イベントに 1 つの名前を付けたいと思います。

これは私のコード使用クリックイベントです:

 $(this).bind("click.soundcard", function(){
        //play a sound
    });
    $(this).bind("click.step", function(){
        // display the number step 
    });
    $(this).bind("click.selectcard", selectCard); 

そして、1つのイベントを削除したいときは、次のように呼び出します:

$(this).unbind("click.nameEvent");

そして私の質問は、タッチイベントで同じことをする方法がありますか、それを行うために使用できるプラグインがありますか?

4

1 に答える 1

1

イベント名前空間はあらゆるイベント タイプで使用できるため、

$(this).bind("touch.touch", function(){
    //play a sound
});
$(this).bind("touch.step", function(){
    // display the number step 
});
$(this).bind("touch.selectcard", selectCard); 

次に、最初のハンドラのバインドを解除します

$(this).unbind("touch.touch");
于 2013-07-12T04:42:26.657 に答える