Touchmove与Phonegap

ojs*_*bal 4 javascript jquery jquery-mobile cordova

我真的在Phonegap和JQuery的Android应用程序上苦苦挣扎.

我想做的就是将touchmove绑定到一个元素,然后在我移动手指时检查X和Y坐标(基本上是拖动)

$('#someElm').bind('touchmove',function(event){
        //Code here..!
});
Run Code Online (Sandbox Code Playgroud)

当我触摸屏幕时,touchmove会触发,但之后我真的不知道事件的对象是什么 - 我已经尝试过event.screenX,event.pageX,但是没有用.

有任何想法吗?

Dan*_*rka 6

这里的移动safari参考(android基本相同):

http://developer.apple.com/library/IOS/#documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html

你想要的是:

var x = event.touches[0].pageX;
var y = event.touches[0].pageY;
Run Code Online (Sandbox Code Playgroud)

如果您在Android上运行,您还需要在触摸时取消touchmove事件以获取新事件.不要问我为什么......