-2

私には大きな問題が1つあります。私が作成したサイトは、デスクトップコンピューターでは機能しますが、モバイル(タッチスクリーン)やiPhoneおよびiPadでは機能しません。このサイトでは、マウスホイールを上下方向にスクロールし、キーボタンを4方向すべて(左/右/上/下)にスクロールしていますが、ここでもスワイプコマンドを機能させるにはどうすればよいですか?

http://socketstudios.com/のようなサイトがあります!

4

2 に答える 2

0

このプラグインを使用して、スワイプイベントをバインドできます: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();
    }
});
于 2013-02-06T18:10:59.670 に答える
0

この種の機能用に構築されたJQueryMobileイベントを確認することをお勧めします。

例: http ://stephband.info/jquery.event.swipe/

于 2013-02-06T18:21:04.570 に答える