Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
簡単な例:
$('foo').bind('doubletap swiperight', function() {});
だから、私は本当に効率的にしようとしています。効率が高すぎるかもしれませんが、イベントをオブジェクトに1回バインドしてから、「右にスワイプするとこれを実行します。ダブルタップするとこれを実行します」と言います。
これは可能ですか?
よろしくお願いします!
アレックス
次を使用して、ハンドラー関数内からイベントのタイプを判別できますevent.type。
event.type
$('foo').bind('doubletap swiperight', function(e) { if (e.type == "doubletap") { // tap code } else if (e.type == "swiperight") { // swipe code } });