I am using the below code to get the touch coordinates in iOS Safari
$('#touchable').bind('touchstart', function(e){
alert(e.touches[0].pageX);
alert(e.touches[0].pageY);
}
But when I test it I am unable to get the coordinates. Is this code the right way to get the touch coordinates ?
Prefer the following link :
Detect Safari Touch
and try this code
document.addEventListener('touchmove', function(e) {
e.preventDefault();
var touch = e.touches[0];
alert(touch.pageX + " - " + touch.pageY);
}, false);
to add touchEvent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With