Android 2.2 browser does not work pageY or PageX in ontouchend event

I have a web application that works fine in Android 2.1, when I update the pageX property in the ontouchend event to 2.2, this is my code:

menu1.ontouchend = function (e) {
e.preventDefault ();
if (e.touches && e.touches.length> 0) {// iPhone
    x2 = e.touches [0] .pageX;
    y2 = e.touches [0] .pageY;
} else {// all others
    x2 = e.pageX;
    y2 = e.pageY;
}
}

Does anyone know what changes to the javascript API are for touch events from 2.1 to 2.2 ?????

+3
source share
1 answer

You can try:

event.targetTouches [0] .pageX

, , "touchmove". , ( "touchmove" ) "touchhend".

0

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


All Articles