标签:document doc pre script div ext 滑动 ica nbsp
手势包括点击(tap),长按(press),滑动(swipe),方向(pan)
使用实例:
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1"> <meta charset="UTF-8"> <link rel="stylesheet" href="reset.min.css" /> <title></title> <style> #myElement { background: silver; height: 300px; text-align: center; font: 30px/300px Helvetica, Arial, sans-serif; } </style> </head> <body class="flex-column center-center"> <div id="myElement"></div> <script type="text/javascript" src="hammer.js"></script> <script> var myElement = document.getElementById(‘myElement‘); var hammer = new Hammer(myElement); hammer.on("swipeleft", function (ev) { console.log(ev.type); }); hammer.on("swiperight", function (ev) { console.log(ev.type); }); hammer.on("panleft panright panup pandown tap press", function (ev) { console.log(ev.type); }); </script> </body> </html>
标签:document doc pre script div ext 滑动 ica nbsp
原文地址:https://www.cnblogs.com/yycc11/p/9450922.html