HTML5 /安卓touchcanceltouchcancel

2023-09-05 02:03:58 作者:高冷的

我努力工作,在接口上的HTML5移动。 我尝试跟随解放运动,用touchstart / touchmove / touchend / touchcancel。 但是当我尝试跟随解放运动我永诺quikly有非盟touchcancel并没有更多的touchmove然后...

I try to work on an interface on html5 for mobile. i try to follow a mouvement, with touchstart/touchmove/touchend/touchcancel. but when i try to follow a mouvement i allways quikly have au 'touchcancel' and no more touchmove then...

当我尝试这个办法: http://miniapps.co.uk/$c$c/touchcancel/ 它很好地工作,我没有任何问题。

when i try this : http://miniapps.co.uk/code/touchcancel/ it work perfectly, i do not have any problem.

但我认为这个问题是来自与我的画布干扰的Web浏览器的解放运动。 你知道我可以解决这一问题?

But i think the problem come from the mouvement of the web browser that interfering with my canvas. Do you know can i fix this ?

//我试图解释更多: - 这是我的测试code: http://frys.free.fr/mNaissance/test.html 它的拼图拼图code,我尽量做到与移动合作。 我有一个登录格hunder文本。 当我做touchmove灰色的画布上我有非常快的一个touchcancel',没有了'touchmove 是不是更清楚了吗?对不起,我的英文不好!

// I try to explain more : - Here is my test code : http://frys.free.fr/mNaissance/test.html it's the "Jigsaw" puzzle code that i try to make working with a mobile. I had a "log" div hunder the text. And when i do "touchmove" on the grey canvas i have very fast a 'touchcancel' and no anymore 'touchmove' Is it more clear ? sorry for my poor english !

感谢您的帮助

推荐答案

我相信我找到了这样做的原因 - (针对Android 4.0+和Chrome浏览器),Android浏览器相信您要滚动,所以它触发touchcancel事件。你应该做的是

I believe I found out the reason for this - Android browser (as well as Chrome for Android 4.0+) believes you are trying to scroll, so it fires the touchcancel event. What you should do is

event.preventDefault();

在您捕获touchmove事件。

on touchmove event you are capturing.