如何正确绑定Zepto的触摸功能?

CSt*_*ess 3 javascript zepto

我正在尝试将事件绑定到touchstart,touchmove和touchend属性,以跟踪触摸的位置.这是我的代码:

$('#container').bind('touchstart touchmove touchend', function (event) { updateFinger(event); });
Run Code Online (Sandbox Code Playgroud)

更新手指功能:

var updateFinger = function(e)
{
  e.preventDefault();
  fingerX = e.data.x1;
  fingerY = e.data.y1;
  alert(fingerX + ' ' + fingerY);
}
Run Code Online (Sandbox Code Playgroud)

我知道函数被调用,但据我所知,e.data.x1和e.data.y1不存在(以及.x).我正在使用文档中的代码,任何人都可以帮我解决这个问题吗?

编辑:我修复了问题,事实证明我使用了错误的代码.

代替

e.data.x1
Run Code Online (Sandbox Code Playgroud)

你需要使用

e.touches[0].pageX
Run Code Online (Sandbox Code Playgroud)