使用している唯一のコントロールがScrollableである場合は、ここからソース コードを編集して、その動作を修正するか、必要に応じて適応させることができます。
あなたが投稿したフィドルを修正して、コード セクションにScrollableコントロールのコードを含めましたJavaScript
。
コントロールのコードに追加された行は// added
、次のスニペットの最後にコメントがある行です。
// touch event
if (conf.touch) {
var touch = {};
itemWrap[0].ontouchstart = function(e) {
var t = e.touches[0];
touch.x = t.clientX;
touch.y = t.clientY;
};
itemWrap[0].ontouchmove = function(e) {
// only deal with one finger
if (e.touches.length == 1 && !itemWrap.is(":animated")) {
var t = e.touches[0],
deltaX = touch.x - t.clientX,
deltaY = touch.y - t.clientY,
absX = Math.abs(deltaX), // added
absY = Math.abs(deltaY); // added
// Only consider the event when the delta in the
// desired axis is greater than the one in the other.
if(vertical && absY > absX || !vertical && absX > absY) // added
self[vertical && deltaY > 0 || !vertical && deltaX > 0 ? 'next' : 'prev']();
e.preventDefault();
}
};
}
ネイティブ ブラウザと Opera ブラウザを使用して Android でこれを試してみましたが、期待どおりに動作するようです。