前提:touchstart,touchmove,touchend這三個事件可以通過原生和jq綁定。
原生:document.querySelector("#aa").addEventListener('touchmove', function(){...});
jq: $(".aa").on("touchmove",function (e) {...};
1.獲取當前touch位置
$('#webchat_scroller').on('touchstart',function(e) {
var touch = e.originalEvent.targetTouches[0];
var y = touch.pageY;
});
$('#webchat_scroller').on('touchmove',function(e) {
var touch = e.originalEvent.targetTouches[0];
var y = touch.pageY;
});
$('#webchat_scroller').on('touchend',function(e) {
var touch = e.originalEvent.changedTouches[0];
var y = touch.pageY;
});