用法:
先引用swiper插件,百度搜索就有,然后执行以下代码: (注:绑定html或者body都有效)
<script src="swiper-3.4.2.jquery.min.js"></script> <script> var mySwiper = new Swiper('html',{ onTouchMove: function(e){ var dist=e.touches.currentY-e.touches.startY; console.log(dist); if(dist<0){ //向上 }else if(dist>0){ //向下 } } }) </script>