左にスワイプしてログに記録するには、
$('.image').on('swipeleft', function (e) {
console.log('swipeleft');
});
右のために
$('.image').on('swiperight', function (e) {
console.log('swiperight');
});
これをコードの関数$(document).on('pageinit', function() {}
に配置します。
これらのイベントは拡張できます。これはこれらのイベントのデフォルトです
$ .event.special.swipe.handleSwipe:
function( start, stop ) {
if ( stop.time - start.time < $.event.special.swipe.durationThreshold &&
Math.abs( start.coords[ 0 ] - stop.coords[ 0 ] ) > $.event.special.swipe.horizontalDistanceThreshold &&
Math.abs( start.coords[ 1 ] - stop.coords[ 1 ] ) < $.event.special.swipe.verticalDistanceThreshold ) {
start.origin.trigger( "swipe" )
.trigger( start.coords[0] > stop.coords[ 0 ] ? "swipeleft" : "swiperight" );
}
}