打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
移动端事件(其他触摸事件)hammer.js

通过对touch的基础事件的封装,可以完成高级事件

 

hammer.js  http://hammerjs.github.io/

方便使用移动端高级事件 (而且兼容性很好)

 

 

中文文档 https://www.cnblogs.com/qianduanjingying/p/5812139.html

 

swipe 快速滑

pan 慢慢滑

<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>touch</title>    <style>        .box{            width:90px;            height:90px;            background:pink;        }    </style></head><body>    <div class="box" id="box"></div>    <script src="hammer.min.js"></script>    <script>        var hammer=new Hammer(box);        hammer.on("swipe pan tap doubletap press pinch rotate",function(e){            console.log(e.type);            console.log(e);        });        //可用于幻灯片        hammer.on("swiperight",function(e){            console.log("prev");        });        hammer.on("swipeleft",function(e){            console.log("next");        });    </script></body></html>

 

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
addEventListener() 事件监听
解决同一页面jQuery多个版本或和其他js库冲突方法
JavaScript框架从入门到精通
IdentityServer4 (4) 静默刷新(Implicit)
通过node.js进行前后端分离
js中的事件流(对js事件流简单的了解介绍)
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服