私には大きな問題が1つあります。私が作成したサイトは、デスクトップコンピューターでは機能しますが、モバイル(タッチスクリーン)やiPhoneおよびiPadでは機能しません。このサイトでは、マウスホイールを上下方向にスクロールし、キーボタンを4方向すべて(左/右/上/下)にスクロールしていますが、ここでもスワイプコマンドを機能させるにはどうすればよいですか?
http://socketstudios.com/のようなサイトがあります!
このプラグインを使用して、スワイプイベントをバインドできます:http://labs.skinkers.com/touchSwipe/
例: http: //labs.skinkers.com/touchSwipe/demo/Basic_swipe.html コード例:
$("#test").swipe( {
//Generic swipe handler for all directions
swipeLeft:function(event, direction, distance, duration, fingerCount) {
alert("Swiped 50px left")
},
threshold:50
});
上記のコードはページを直接移動しません!そこにあなたはプロパティを使用することができますswipeStatus
$("#test4").swipe( { swipeStatus:swipe2, allowPageScroll:"vertical"} );
これを試して:
$("body").swipe( {
swipeUp:function(event, direction, distance, duration, fingerCount) {
scroll_up();
},
swipeDown:function(event, direction, distance, duration, fingerCount) {
scroll_down();
},
swipeLeft:function(event, direction, distance, duration, fingerCount) {
scroll_left();
},
swipeRight:function(event, direction, distance, duration, fingerCount) {
scroll_right();
}
});
この種の機能用に構築されたJQueryMobileイベントを確認することをお勧めします。