var _scrollIndex=1;
function scrollPage(){
var _contentEle = $('.view-container'),_viewEle = _contentEle.find('.view');
var _iconEle = $('.downIconArror');
var _view_port = $('.view-port');
var _touchEvents = {
'pageYStart':'',
'pageYEnd':'',
'touchstart':function(event){
event.preventDefault();
var _touch = event.touches[0],_this = _touchEvents;
_this.pageYStart = _touch.pageY;
_view_port[0].addEventListener('touchmove',_this.touchmove,true);
_view_port[0].addEventListener('touchend',_this.touchend,true);
},
'touchmove':function(event){
event.preventDefault();
var _touch = event.touches[0],_this = _touchEvents;
_this.pageYEnd = _touch.pageY;
},
'touchend':function(event){
var _this = _touchEvents;
var _distance = _this.pageYEnd-_this.pageYStart;
if(_distance>50){
swipe.down();
}
if(_distance<-50){
swipe.up();
}
_view_port[0].removeEventListener('touchmove',_this.touchmove);
_view_port[0].removeEventListener('touchend',_this.touchend);
}
};
_view_port[0].addEventListener('touchstart',_touchEvents.touchstart);
var swipe = {
up:function(){
var _this = _contentEle;
var _initTransY = getTransform(_this);
if(Math.abs(_initTransY)==(_viewEle.length-1)*_viewEle.height()){
return;
}
if(Math.abs(_initTransY)==(_viewEle.length-2)*_viewEle.height()){
_iconEle.hide();
}else{
_iconEle.show();
}
_scrollIndex++;
scrollPageAnimate(_scrollIndex);
_this.animate({'margin-top':parseInt(_initTransY-_viewEle.height())},500);
},
down:function(){
var _this = _contentEle;
var _initTransY = getTransform(_this);
_iconEle.show();
if(_initTransY==0){
return;
}
_scrollIndex--;
scrollPageAnimate(_scrollIndex);
_this.animate({'margin-top':parseInt(_initTransY+_viewEle.height())},500);
}
}
}

mobile touch 备用的更多相关文章

  1. mobile touch事件

    touch.js 众所周知,mobile与pc 前端开发的不同中,有一点就是事件的不同,mobile上有touchstart,touchmove,touchend等,而pc上用最多的应该还是我们的cl ...

  2. jquery mobile Touch事件

    Touch事件在用户触摸屏幕(页面)时触发 1.jquery mobile tap tap事件在用户敲击某个元素时触发 $("p").on("tap",fucn ...

  3. jquery mobile touch 实例

    <!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> ...

  4. 触屏touch事件记录

    一.chrome中的Remote Debugging 一开始并没有用这个调试,不过后面需要多点触碰,可chrome模拟器中我没看到这个功能.突然看到了Remote Debugging,网站需要FQ才能 ...

  5. hammerjs & Swiper & touch & gesture

    hammerjs https://hammerjs.github.io/getting-started/ http://hammerjs.github.io/recognizer-swipe/ Swi ...

  6. web & js & touch & gesture

    web & js & touch & gesture 触摸 & 手势 https://caniuse.com/#feat=touch js https://develo ...

  7. JavaScript资源大全中文版(Awesome最新版)

    Awesome系列的JavaScript资源整理.awesome-javascript是sorrycc发起维护的 JS 资源列表,内容包括:包管理器.加载器.测试框架.运行器.QA.MVC框架和库.模 ...

  8. 超级小的web手势库AlloyFinger发布

    简介 针对多点触控设备编程的Web手势组件,快速帮助你的web程序增加手势支持,也不用再担心click 300ms的延迟了.拥有两个版本,无依赖的独立版和react版本.除了Dom对象,也可监听Can ...

  9. 2016年4月最佳的20款 jQuery 插件推荐

    这个列表包括20个我们觉得是最有用的免费的 jQuery 插件,它们都是最具创新性和最省时省力的解决方案,很多都是现代化的设计和开发中碰到的问题的处理方案.如果你熟悉下面列出的任何插件,请与我们的读者 ...

随机推荐

  1. JS计算两时间的天数

    <html xmlns="http://www.w3.org/1999/xhtml"> <head> </head> <body>& ...

  2. ant整合junit自己主动化測试

    一. 使用Junit进行測试 1. Java业务代码: public class HelloWorld { // 測试返回"world" public String hello() ...

  3. C++实现顺序栈的基本功能

    栈是限定仅在表头进行插入和删除操作的线性表.有着先进后出的特点(FILO): 如今我来动手实现栈的基本本功能练练手: 定义栈的头文件例如以下: #ifndef CSTOCK_H_ #define CS ...

  4. runtime objc_msgSend

    runtime objc_msgSend 字数1781 阅读245 评论2 喜欢7  前言 想要通过runtime发送消息,就必须要掌握runtime如何发送消息,是调用哪个函数?又是如何调用的?本篇 ...

  5. 【撸码caffe 三】 caffe.cpp

    caffe.cpp文件完成对网络模型以及模型配置参数的读入和提取,提供了网络模型训练的入口函数train和对模型的测试入口函数test.文件中使用了很多gflags和glog指令,gflags是goo ...

  6. [codeforces contest 1119 F] Niyaz and Small Degrees 解题报告 (树形DP+堆)

    interlinkage: http://codeforces.com/contest/1119/problem/F description: 有一颗$n$个节点的树,每条边有一个边权 对于一个$x$ ...

  7. A - Antipalindrome

    Problem description A string is a palindrome if it reads the same from the left to the right and fro ...

  8. C# DataTable常用方法总结

    https://blog.csdn.net/wangzhen209/article/details/51743118

  9. hdu 2768 Cat vs. Dog 最大独立集 巧妙的建图

    题目分析: 一个人要不是爱狗讨厌猫的人,要不就是爱猫讨厌狗的人.一个人喜欢的动物如果离开,那么他也将离开.问最多留下多少人. 思路: 爱猫和爱狗的人是两个独立的集合.若两个人喜欢和讨厌的动物是一样的, ...

  10. deeplearning4j – 分布式DL开源项目

    原文链接:http://www.52ml.net/16157.html Deeplearning4j is the first commercial-grade deep learning libra ...