HTML5移动端通过touch事件判断手势方向及页面到达底部
来源:互联网 发布:js获取今天年月日 编辑:程序博客网 时间:2024/06/13 00:57
startClientY:0,//屏幕开始滑动位置endClientY:0,//屏幕结束滑动位置movedirection:'CENTER',//滑动方向lastscrolltop:0,//上一次的滚动距离handleStart (e){this.lastscrolltop=0;//重置上次位置this.startClientY= e.touches[0].clientY; console.log("开始位置:",this.startClientY)},handleMove (e) { var dom = $(".contract_list");//可滚动区域 var scrollTop = dom.scrollTop();//获取滚动的距离 this.endClientY = e.touches[0].clientY;//更新手指当前屏幕Y轴位置--结束位置 console.log("结束位置:",this.endClientY) //判断是否滚动到底部 if (scrollTop - this.lastscrolltop > 0) { this.lastscrolltop = dom.scrollTop() console.log("继续滚动,scrollTop:", scrollTop) } else if (scrollTop != 0 && this.lastscrolltop !=0 && scrollTop - this.lastscrolltop == 0) { console.log("到底了!") } //判断手指滑动方向 if(e.touches[0].clientY < this.startClientY){ this.movedirection = "UP"; }else if(e.touches[0].clientY > this.startClientY){ this.movedirection = "DOWN"; }else{ this.movedirection = "CENTER"; } console.log('手指方向:',this.movedirection) this.startClientY = e.touches[0].clientY;//判断是否滚动到底部 if (scrollTop - this.lastscrolltop > 0) { this.lastscrolltop = dom.scrollTop() console.log("继续滚动,scrollTop:", scrollTop) } else if (scrollTop != 0 && this.lastscrolltop !=0 && scrollTop - this.lastscrolltop == 0) { console.log("到底了!");//这里做一些事情 }
阅读全文
0 0
- HTML5移动端通过touch事件判断手势方向及页面到达底部
- H5案例分享:移动端touch事件判断滑屏手势的方向
- html5移动端手势事件
- H5移动端判断手势滑动方向
- 判断滚动条是否到达底部事件
- 判断滚动条是否到达页面底部
- JS判断是否到达页面底部
- 对于移动端浏览器touch事件的研究总结(4)判断手指滑动方向
- html5移动端触摸事件touch
- View到达顶部及底部边界判断
- 浅谈移动端之js touch事件 手势滑动事件
- 根据移动速度方向判断手势方向
- HTML5移动端touch滑动与重力/方向感应结合
- 移动设备手势事件库Touch.js
- touch事件解析判断拖动方向
- 移动端touch事件
- HTML在移动端页面设计是touch事件注意事项
- 移动端touch事件实现页面弹动--小插件
- n皇后,排列树
- Android录音与播放录音实现
- 黑客术语基础知识
- ASP.NET身份验证方式
- Windows下使用linux命令
- HTML5移动端通过touch事件判断手势方向及页面到达底部
- 安卓开发获取总方法数
- ubuntu apt-get update 失败解决方法
- 生成数据表的SQL 语句
- 本地Yum 仓库 iOS文件挂载
- HDU
- 使用K近邻分类器对鸢尾花数据进行类别预测
- Common(三)—— CMsg
- 网银项目记录