手机端html滑动处理
作者:互联网
$('.pushJie').on('touchstart',touchStartFun).on('touchmove',touchmoveFun).on('touchend',touchendFun); function touchStartFun(e){ e.preventDefault(); touchStartX = e.originalEvent.changedTouches[0].pageX; touchStartY = e.originalEvent.changedTouches[0].pageY; } function touchmoveFun(e){ e.preventDefault(); endX = e.originalEvent.changedTouches[0].pageX; endY = e.originalEvent.changedTouches[0].pageY; //获取滑动距离 distanceX = touchStartX-endX; distanceY = touchStartY-endY; } function touchendFun(e){ e.preventDefault(); //处理业务 }
标签:function,originalEvent,手机,preventDefault,html,changedTouches,滑动,touchendFun,touc 来源: https://www.cnblogs.com/-lin/p/11610896.html