私はイメージ ギャラリー [html5] に取り組んでおり、デスクトップ バージョンで問題なく動作しています。Ipad/タブレット デバイス用のタッチ ベースのイベントを追加したいと考えています。
javascript/jquery を使用してタッチ ベースのイベントを追加する方法を教えてください。
ありがとう、スリニバス
私はイメージ ギャラリー [html5] に取り組んでおり、デスクトップ バージョンで問題なく動作しています。Ipad/タブレット デバイス用のタッチ ベースのイベントを追加したいと考えています。
javascript/jquery を使用してタッチ ベースのイベントを追加する方法を教えてください。
ありがとう、スリニバス
この jQuery プラグインはうまく機能します。http://www.netcu.de/jquery-touchwipe-iphone-ipad-library 使いやすい。元:
$('.slideshow').touchwipe({
 wipeLeft: function() {$('.slideshow').cycle('next');},
 wipeRight: function() { $('.slideshow').cycle('prev');},
 min_move_x: 60         
});
この機能を使用できます
右スワイプまたは別の方向
// jquery mobile
    $("#id").swiperight(function() {
        //do some with $.mobile.changePage function
    });
    $("#id").swipeleft(function() {
        //do some $.mobile.changePage function
    });
// javascript
document.ontouchmove = function(e) {
    var target = e.currentTarget;
    while(target) {
        if(checkIfElementShouldScroll(target))
            return;
        target = target.parentNode;
    }
    e.preventDefault();
};