hammer.js-使用方法
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<title>hammer.js</title>
<style>
.box {
width: 150px;
height: 150px;
background-color: red;
margin: 20px auto;
}
</style>
</head>
<body>
<div id="box" class="box"></div>
<script src="./js/hammer.min.js"></script>
<script>
var box = document.getElementById('box');
var hammer = new Hammer(box)
hammer.on('swipe pan tap doubletap press pinch rotate',function(e){
console.log(e);
})
hammer.on('swipeleft',function(e){
console.log(e.type);
})
hammer.on('swiperight',function(e){
console.log(e.type);
})
</script>
</body>
</html>
我是Eric,手机号是13522679763