5

jquery モバイル ベータ版と jquery 1.6 を使用しています。iPod touch では、スワイプ イベントもタップ イベントをトリガーしています。この問題は、Android デバイスでは発生していません。解決策をグーグルで検索しようとしていますが、同じ問題を抱えている人はあまりないようです。私が見逃している非常に基本的なものはありますか??

$("div.totapandswipe").bind('tap',function(event, ui){
    alert('event');
});

$("div.totapandswipe").bind('swipe',function(event, ui){
            alert('event');
});

お手伝いありがとう!

4

2 に答える 2

2

bind('swipeleft swiperright') 関数の最初のオプションとして unbind('click') する必要があることがわかりました。私のスワイプは新しいページに移動するため、そのページは、離れたばかりのページの「クリック」イベントを再バインドします。私のユーティリティは、タップすると新しいカードが表示され、スワイプするとめくられるフラッシュカードです。幸運を。

$('#flashVerse').bind('swipeleft swiperight', function(event) {
    console.log(event.type);
    $('#flashVerse').unbind('click');
    if(event.type == 'swipeleft') {
        $.mobile.changePage('flashReference','flip');
    } else {
        $.mobile.changePage('flashReference','flip',true,false);
        console.log('SWIPERIGHT');
    }
});

$('#flashReference').live('pageshow',function(event,ui){
    if((tipsOn() || ls.getItem('tipFlash') == '1') && ui.prevPage.attr('id')!='flashVerse') {
        ls.setItem('tipFlash','0');
        var msg = 'Swipe to flip the card.\n Tap for a new card.\nuse Options to turn Tips back on.';
        if(phoneGap) navigator.notification.alert(msg,dummy,'Flash Cards','OK');
        else alert(msg);
    }
    $('#lnkFlashVerse').addClass('ui-btn-active').addClass('ui-state-persist');
    $('#lnkFlashReference').removeClass('ui-btn-active').removeClass('ui-state-persist');
    $('#flashReference').bind('click', function(event) {
        console.log(event.type);
        newFlashCard();
        //$('#flashReference div[data-role="content"]').append('clicked ');
    });
});
于 2011-07-20T15:10:39.967 に答える
1

これは私を助けたようです:

$("selector").swiperight(function (e) {
  if (e.type === "swiperight") {
    myHandler(e);
  }
});

これが問題になるのはだめです。これに関する Jqm バグはまだありますか?

于 2011-08-18T14:21:00.853 に答える