html5 touch事件实现触屏页面上下滑动(一)
发布时间:2020-03-13 12:03:24 所属栏目:MySql教程 来源:站长网
导读:这篇文章主要为大家详细介绍了html5 touch事件实现触屏页面上下滑动的相关代码,代码注释很清楚,感兴趣的小伙伴们可以参考一下
var touch=e.touches[0]; startY = touch.pageY; //刚触摸时的坐标 }
function touchMove(e){//滑动 e.preventDefault(); var touch = e.touches[0]; y = touch.pageY - startY;//滑动的距离 //inner.style.webkitTransform = 'translate(' + 0+ 'px, ' + y + 'px)'; //也可以用css3的方式 (编辑:焦作站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |