Android Browser Touch Screen Location

In Safari, you can find the location where the user touched the screen with event.pageX and event.pageY. However, in my Android browser, event.pageX and event.pageY are always 0. Is there a way to get the location of a touch event in an Android browser?

+4
source share
1 answer

This is from memory, since I no longer own the Android device, but I think it is correct. At the very least, this should make you start in the right direction. Good luck.

var elem = document.getElementById('elem'); elem.addEventListener('touchend', function(e){ var pageX = e.changedTouches[0].pageX, pageY = e.changedTouches[0].pageY; }, false); 
+8
source

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


All Articles