“touch”事件鼠标参数位置:
源生:
e.touches[0]
JQuery:
e.originalEvent.touches[0]
在JQuery使用“touch”事件不能直接绑定:
$(...).touchstart(function(){...}); //无效
需要使用“bind()”这类方法来进行绑定
$(...).bind('touchstart',function(){...});
使用源生JavaScript绑定“touch”事件:
var obj = document.getElementById('...');
obj.addEventListener('touchstart',function(e){...},false);
解除绑定方法为:“removeEventListener()”
在解除绑定的时候参数需与绑定的参数相同,且不能解除 绑定匿名函数的事件,如下:
//无效
obj.addEventListener('touchstart',false);
obj.removeEventListener('touchstart',false);
//有效
obj.addEventListener('touchstart',func,false);