$(function(){
(function(){ var LSwiperMaker = function(o){ var that = this;
this.config = o;
this.control = false;
this.sPos = {};
this.mPos = {};
this.dire; // this.config.bind.addEventListener('touchstart', function(){ return that.start(); } ,false);
// 这样不对的,event对象只在事件发生的过程中才有效;
this.config.bind.addEventListener('touchstart', function(e){ return that.start(e); } ,false);
this.config.bind.addEventListener('touchmove', function(e){ return that.move(e); } ,false);
this.config.bind.addEventListener('touchend', function(e){ return that.end(e); } ,false); };
LSwiperMaker.prototype.start = function(e){
var point = e.touches ? e.touches[0] : e;
this.sPos.x = point.screenX;
this.sPos.y = point.screenY;
};
LSwiperMaker.prototype.move = function(e){ var point = e.touches ? e.touches[0] : e;
this.control = true;
this.mPos.x = point.screenX;
this.mPos.y = point.screenY; }; LSwiperMaker.prototype.end = function(e){ this.config.dire_h && (!this.control ? this.dire = null : this.mPos.x > this.sPos.x ? this.dire = 'R' : this.dire = 'L');
this.config.dire_h || (!this.control ? this.dire = null : this.mPos.y > this.sPos.y ? this.dire = 'D' : this.dire = 'U'); this.control = false;
this.config.backfn(this); }; window.LSwiperMaker = LSwiperMaker;
document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);// 禁止微信touchmove冲突
}());
for(var i= 1;i<7;i++){
function hd(i){
var a = new LSwiperMaker({
bind:document.getElementById("page"+i+""), // 绑定的DOM对象
dire_h:false, //true 判断左右, false 判断上下
backfn:function(o){ //回调事件             //这里写怎样滑动           }
});
}
hd(i);
} });

  

最新文章

  1. 如何把Spring制作成jar包,然后在项目里运行。
  2. wireshark lua脚本
  3. 继续Wcf记录点滴
  4. sort如何按指定的列排序
  5. hibernate将本地SQL查询结果封装成对象
  6. JS获得事件发出者
  7. C#语法中一个问号(?)和两个问号(??)的运算符是什么意思?
  8. Android获取设备隐私 忽略6.0权限管理
  9. java测试1
  10. 随学随记之java的数据类型
  11. .NET运行机制
  12. django-redis
  13. Linux创建和挂载XFS文件系统测试实践
  14. angular2路由与express路由冲突的问题
  15. asynicio模块以及爬虫应用asynicio模块(高性能爬虫)
  16. 潭州课堂25班:Ph201805201 django 项目 第四十二课 后台 课程相关,用户组管理 (课堂笔记)
  17. 第一次学习手游开发:Flappy Bird制作
  18. docker执行第一个应用
  19. 工作中经常用到github上优秀、实用、轻量级、无依赖的插件和库
  20. python上传图片并识别图片

热门文章

  1. 2019-7-2-asp-dotnet-core-通过图片统计-csdn-用户访问
  2. passwd的使用例子
  3. make: 警告:检测到时钟错误。您的创建可能是不完整的。
  4. SpringData_03_Specifications动态查询
  5. mui.fire()用法
  6. OpenCASCADE点向圆柱面投影
  7. JPA 中注解的作用
  8. 转载:python操作excel表格(xlrd/xlwt)
  9. java代码优化写法(转摘)
  10. java连接neo4j