如果我赶上从移动设备与所有touchend事件:touchend事件属性
$(document.body).bind('touchend', function (e) {
var touch = e.touches[0]; // doesnt work
...
我需要从电子放慢参数得到touch.screenX,touch.screenY,touch.clientX和touch.clientX。我见过的所有例子都表明e.touches将会是一个集合,你可以通过e.touches[0]
获得触摸细节。在我对ipad的测试中,e.touches
始终未定义。我没有使用任何jQuery插件。
也试过e.targetTouches,这也是未定义的。
任何人都可以帮忙吗?
不应该这是公认的答案?投票! –
我同意,这是正确的解决方案。我自己正在使用它,因为它具有所需的正确数据,并且为什么要混合比需要更多的API。 –
如果您使用的是jQuery,则android不是这种情况。 $('#test')。on('touchend',function(evt){console.log(evt.changedTouches);});是空的,如果你做$('#test')。bind('touchend'...,但是如果你将jquery从等式中删除并且执行getElementBy和addEventListener,它会起作用。 – WORMSS