【发布时间】:2014-02-13 17:38:46
【问题描述】:
当我尝试检查 this jsbin demo 中的 touchmove 事件时,它只会在 Chrome 和 Opera for Android 中触发一次,然后立即触发 touchcancel 事件,而不是继续触发 touchmove 事件?
基于the W3C specs,以及 Firefox for Android 和 Android 的默认浏览器中 touchmove 事件的行为,在我看来,触摸事件的工作方式应该是 touchmove 事件触摸仍在页面上时不断触发。在trying to test in this 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)时发生的情况。按照上面提到的specs,touchcancel 事件应该仅在某些干扰时运行,例如浏览器界面(如果我理解正确的话)。
由于我只是在身体上滑动手指,根本没有离开窗户,我对此感到非常困惑,所以有人知道为什么会这样吗?
我在 Chrome 32 和 Opera 19 for Android 中得到了这个意想不到的结果。
【问题讨论】:
标签: javascript android touch touchmove