I'm using the taphold event in my project and need the coordinates of the point where the user tapped. Unfortunately, event.clientX and event.clientY are undefined (cp. my example here). Is there a possibility to get these coordinates similar to the onclick-event?
Thanks in advance!
I'm using the taphold event in my project and need the coordinates of the point where the user tapped. Unfortunately, event.clientX and event.clientY are undefined (cp. my example here). Is there a possibility to get these coordinates similar to the onclick-event?
Thanks in advance!
Share Improve this question asked Feb 20, 2013 at 13:20 sbaltessbaltes 4791 gold badge9 silver badges17 bronze badges1 Answer
Reset to default 11You will need to cheat a bit, I made a working example for you: http://jsfiddle/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 desktop Firefox, Android 4.1.1 Chrome and iPad 6.0