手机端滑动、长按事件插件touchswipe.js的使用示例
来源:互联网 发布:区域增长算法 matlab 编辑:程序博客网 时间:2024/06/15 01:15
请在这里查看示例 ☞ touchSwipe示例
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" id="viewport" content="width=device-width, initial-scale=1"> <title>demo</title> <script src="../js/jquery-1.11.3.min.js"></script> <script src="js/jquery.touchSwipe.min.js"></script> <style> * {margin: 0; padding: 0;} body,html {width: 100%; height: 100%; background: pink;} .div1 {height: 200px; background: red;} .div2 {height: 200px; background: blue;} </style> </head> <body> <p>改 demo 待完善...</p> <p>建议在手机端测试</p> <p class="disable">禁用</p> <p class="enable">恢复</p> <p class="destroy">销毁</p> <p class="init">初始化</p> <div class="div1"> 滑动这里 </div> <div class="div2"> </div> <script> $(function() { //兼容ie8+、手机端 $('.div1').swipe({ /*swipe: function(event, direction, distance, duration, fingerCount, fingerData) { $('body').append('direction -> '+ direction); $('body').append('distance -> '+ distance); $('body').append('duration -> '+ duration); $('body').append('fingerCount -> '+ fingerCount); },*/ /*//向左滑 swipeLeft: function(event, direction, distance, duration, fingerCount, fingerData) { $('body').append('direction -> '+ direction +'<br>'); $('body').append('distance -> '+ distance +'<br>'); $('body').append('duration -> '+ duration +'<br>'); $('body').append('fingerCount -> '+ fingerCount +'<br>'); },*/ /*//滑动过程中 swipeStatus:function(event, phase, direction, distance, duration, fingerCount, fingerData, currentDirection) { var html = 'phase -> '+ phase +'<br>'+ 'direction -> '+ direction +'<br>'+'distance -> '+ distance +'<br>'+'duration -> '+ duration +'<br>'+'fingerCount -> '+ fingerCount +'<br>'+'currentDirection -> '+ currentDirection +'<br>'; $('.div2').html(html); }, triggerOnTouchEnd: false,//启动超过阈值停止插件 <p> threshold: 200,//滑动阈值 distance > threshold 时 phase = end</p><p><span style="white-space:pre"> excludedElements: "button, input, select, textarea, .noSwipe",</span>//让a标签也支持滑动事件</p>allowPageScroll: 'auto',//滑动时不影响滚动条的正常滚动,该项只在swipeStatus生效 maxTimeThreshold: 5000,//触摸阈值 duration > maxTimeThreshold 时 phase = cancle triggerOnTouchLeave: true,//手指离开对象,停止插件 fingers: 'all',//手指数量(手机端生效)*/ tap: function(event, target) { $('.div2').append('<br>tap:'+ $(target).attr('class')); }, doubleTap: function(event, target) { $('.div2').append('<br>doubleTap:'+ $(target).attr('class')); }, hold: function(event, target) { $('.div2').append('<br>hold:'+ $(target).attr('class')); } }).on('click', function(e) {//同时绑定click $('.div2').append('<br>click:'+ $(this).attr('class')); }).on('dblclick', function(e) {//同时绑定click $('.div2').append('<br>dblclick:'+ $(this).attr('class')); }); // $('.disable').on('click', function() { $('.div1').swipe('disable'); }); $('.enable').on('click', function() { $('.div1').swipe('enable'); }); $('.destroy').on('click', function() { $('.div1').swipe('destroy'); }); $('.init').on('click', function() { $('.div1').swipe({ swipe: function() { console.log(1); }, }); }); }); </script> </body> </html>
2 0
- 手机端滑动、长按事件插件touchswipe.js的使用示例
- 手机端滑动插件swiper3.x的使用示例
- 手机端js模拟长按事件(jQuery)
- jQuery移动设备上支持滑动事件(jquery.touchSwipe.min.js)
- JS-手机长按点击事件
- js监听手机端的touch滑动事件
- 手机整屏滑动插件-----fullPage.js------使用
- 一个模拟手机手指滑动事件的jquery插件
- 手机长按触发事件(网页端)
- 手机长按触发事件(网页端)
- 手机长按触发事件(网页端)
- js 手机端滑动分页SPager 基本示例
- jquery.touchSwipe.min.js 的简单用法
- JS 手机端滑动分页插件 SPager 最新版
- listview获得每一项的点击,长按,滑动事件
- RecycleView的单击和长按,滑动事件
- 使用jquery、light7实现手机移动段的长按事件
- 手机左右上下滑动插件--iscroll.js
- CCF ISBN问题
- 点到平面的距离公式推导
- 日期 数字 等的格式转换
- 1008. Elevator (20)
- CodeForces - 367C Sereja and the Arrangement of Numbers (图论&不懂)
- 手机端滑动、长按事件插件touchswipe.js的使用示例
- 关于一般人员的薪水留学人员的薪水等汇总
- 程序上下黑边以及iPad程序四周黑边的问题
- luncene 查询字符串的解析—QueryParser类
- LINUX WIFI的无线接入热点(AP)
- Java - 多线程
- ubuntu sudo update与upgrade的作用及区别
- XAPIAN简介(三)
- 原生js创建一个div层