Skip to content

Commit 5764948

Browse files
author
MeCKodo
committed
添加获取touch屏幕当前位置clientX,clientY
function event_callback(name,fn,dom,e) { var touch = e.touches.length ? e.touches[0] : {}; var newE = { 'type' : name, 'target' : e.target, 'pageX' : touch.pageX || 0, 'pageY' : touch.pageY || 0, 'clientX' : touch.clientX || 0, 'clientY' : touch.clientY || 0 }; //code..... }
1 parent 3ecb0cb commit 5764948

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

asset/toucher.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@
143143
'type' : name,
144144
'target' : e.target,
145145
'pageX' : touch.pageX || 0,
146-
'pageY' : touch.pageY || 0
146+
'pageY' : touch.pageY || 0,
147+
'clientX' : touch.clientX || 0,
148+
'clientY' : touch.clientY || 0
147149
};
148150
//为swipe事件增加交互初始位置及移动距离
149151
if(name.match(/^swipe/) && e.startPosition){
@@ -324,4 +326,4 @@
324326
return function (dom){
325327
return new touch(dom);
326328
};
327-
});
329+
});

0 commit comments

Comments
 (0)