Android浏览器无法正确处理touchmove事件

Joe*_*e50 3 javascript android touch touchmove

当我尝试touchmove这个jsbin演示中检查事件时,它只在Chrome和Opera for Android中触发一次,之后立即触发touchcancel事件,而不是继续触发touchmove事件?

基于W3C规范以及touchmoveFirefox for Android和Android默认浏览器中事件的行为,在我看来触摸事件应该起作用的方式是touchmove事件在触摸仍然在触摸时保持触发页.尝试在这个jsbin中测试之后,我得到了以下日志消息:

touchstart event; starting on (140,197) on the screen, or (381,536) on the page.
touchend event; starting on (undefined,undefined) on the screen, or (undefined,undefined) on the page.
touchstart event; starting on (181,137) on the screen, or (492,372) on the page.
touchmove event; starting on (182,153) on the screen, or (495,416) on the page.
touchcancel event; starting on (undefined,undefined) on the screen, or (undefined,undefined) on the page.
Run Code Online (Sandbox Code Playgroud)

这是我第一次点击屏幕(通过touchstart和显示touchend),然后拖动屏幕(touchstart,touchmovetouchcancel)时发生的情况.按照上面提到的相同规范,touchcancel事件应该在某些事情发生干扰时运行,例如浏览器界面(如果我理解正确的话).

由于我只是简单地将手指滑过身体而没有离开窗户,我对此感到非常困惑,所以有人知道为什么会这样吗?

我在Chrome 32Opera 19 for Android中获得了这个意想不到的结果.

Joe*_*e50 6

事实证明这里的问题只是事件处理程序没有其中的事实event.preventDefault(),因此原始操作仍然执行,这显然中断了触摸事件.要解决此问题,只需添加e.preventDefault()当前事件处理函数以取消当前事件,并使其在Chrome和Opera中按预期工作.

工作演示.