本文介绍了HTML5 /安卓touchcancel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我努力工作,在接口上的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.htmlit'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.

这篇关于HTML5 /安卓touchcancel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 04:01