2012-04-04 58 views
0

我有以下情形:获取的方向(上/下),其中用户是在iPad(touchmove事件)滚动

我有个码,绑定到鼠标滚轮事件

$('#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"); 
    } 
}); 

然后我包含这个Plugin,它提供了使用Iphone/Ipad触摸事件。
请看下面的代码:

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

我想提醒在用户被滚动的方向。我怎样才能做到这一点?

在此先感谢!

回答

2

尝试使用这个真棒图书馆。

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

更多信息:http://jgestures.codeplex.com/

+0

非常有用的插件!谢谢 – 2012-04-05 07:12:30