admin管理员组文章数量:1356716
so basically I want to be able to get the coordinates of the touch when someone swipes across the screen of a touch-enable device powered by iOS or Android.
What I've tried to do so far is as follows.
$('element').bind("touchmove", function(e) {
$(element2).html(e.pageX + "," + e.pageY);
}
plus I've tried the same with "vmousemove"(the jquery mobile equivalent or so it should be), "mousemove" but to no avail. I only get the coordinates of the the initial and end touch.
Thanks in advance
so basically I want to be able to get the coordinates of the touch when someone swipes across the screen of a touch-enable device powered by iOS or Android.
What I've tried to do so far is as follows.
$('element').bind("touchmove", function(e) {
$(element2).html(e.pageX + "," + e.pageY);
}
plus I've tried the same with "vmousemove"(the jquery mobile equivalent or so it should be), "mousemove" but to no avail. I only get the coordinates of the the initial and end touch.
Thanks in advance
Share Improve this question asked Feb 17, 2013 at 20:52 Petar VasilevPetar Vasilev 4,7556 gold badges47 silver badges78 bronze badges2 Answers
Reset to default 6iOS and Android are muti-touch devices. The interaction is handled using touch events:
https://developer.mozilla/en-US/docs/DOM/Touch_events
You're very close... All you needed was the original Event. jQuery wraps these up for you.
e.g.
$('element').bind("touchmove", function(event) {
var e = ev.originalEvent;
var touch = e.touches[0];
$(element2).html(touch.pageX + "," + touch.pageY);
}
EDIT: I forgot about the touches array... my bad.
本文标签: javascriptquottouchmovequot event on Android ampiPhone using PhoneGapStack Overflow
版权声明:本文标题:javascript - "touchmove" event on Android &iPhone using PhoneGap - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743953094a2567648.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论