2012-04-04 9 views
0

私はシナリオを以下た取得:ユーザがiPad上でスクロールされる方向(アップ/ダウン)(touchmoveイベント)

をIは、マウスホイールイベント

$('#main').bind("mousewheel",function(ev, delta) { 
    ev.preventDefault(); 
    if(delta == '-1') { 
     alert("The user is trying to scroll upwards"); 
    } else { 
     alert("The user is trying to scroll down"); 
    } 
}); 

にバインドさのコードを有します私はこの後、Iphone/Ipadタッチイベントの使用を提供するPluginを含めました。次のコードで
ルック:

$('#main').bind('touchmove', function(event) { 
    ev.preventDefault(); 
}); 

は、私は、ユーザーがスクロールされる方向に警告します。これどうやってするの?

ありがとうございます!

答えて

2

この素晴らしいライブラリをお試しください。

jQuery('#swipe').bind('swipeup',eventHandler); 
jQuery('#swipe').bind('swipedown',eventHandler); 

さらに詳しい情報:http://jgestures.codeplex.com/

+0

非常に役に立ったプラグイン!ありがとう –

関連する問題