Touchmove with Phonegap

I am really struggling with an Android app in Phonegap and jQuery.

All I want to do is snap touchmove to the element and then check the X and Y coordinates when moving the finger (basically drag and drop)

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

When you touch the touch screen, touch manipulation is triggered, but then I do not know what event objects are. I tried event.screenX, event.pageX but does not work.

Any ideas?

+4
source share
1 answer

Here is the link for mobile safari (android is basically the same):

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

What would you like:

 var x = event.touches[0].pageX; var y = event.touches[0].pageY; 

If you work in android, you also need to cancel the touchmove event to get new ones by touch. Do not ask me why ...

+5
source

Source: https://habr.com/ru/post/1380077/


All Articles