Reputation: 4059
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 ?
Upvotes: 3
Views: 2861
Reputation: 12641
Prefer the following link :
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.
Upvotes: 3