JQuery mobile: clientX and clientY and taphold event

I am using the taphold event in my project and need the coordinates of the point at which the user knocked. Unfortunately, event.clientX and event.clientY are undefined (see my example here ). Is it possible to get these coordinates similar to onclick-event?

Thanks in advance!

+6
source share
1 answer

You need to fool a little, I made a working example for you: http://jsfiddle.net/Gajotres/STLWn/

$(document).on('vmousedown', function(event){ holdCords.holdX = event.pageX; holdCords.holdY = event.pageY; }); $(document).on('taphold', function(e){ alert('X: ' + holdCords.holdX + ' Y: ' + holdCords.holdY ); }); var holdCords = { holdX : 0, holdY : 0 } 

Tested on Firefox desktop, Android 4.1.1 Chrome and iPad 6.0

+11
source

All Articles