当我尝试在这个 jsbin 演示touchmove
中检查事件时,它只在 Chrome 和 Opera for Android 中触发一次,然后立即触发一个事件,而不是继续触发事件?touchcancel
touchmove
根据W3C 规范以及 Firefox for Android 和 Android 的默认浏览器中的事件行为,在touchmove
我看来,触摸事件的工作方式应该是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.
这就是我第一次点击屏幕(通过touchstart
和显示touchend
)然后拖动屏幕(touchstart
和touchmove
)时发生的情况touchcancel
。按照上面提到的相同规范,touchcancel 事件应该只在有干扰时运行,例如浏览器界面(如果我理解正确的话)。
由于我只是在身体上滑动手指,根本没有离开窗户,我对此感到非常困惑,所以有人知道为什么会发生这种情况吗?
我在Chrome 32和Opera 19 for Android 中得到了这个意想不到的结果。