// 判断上下滑动
var startX = 0,
startY = 0;
function touchStart(evt){
try{
var touch = evt.touches[0], //获取第一个触点
x = Number(touch.pageX), //页面触点X坐标
y = Number(touch.pageY); //页面触点Y坐标
//记录触点初始位置
startX = x;
startY = y;
}catch(e){
console.log(e.message)
}
} function touchMove(evt){
try{
var touch = evt.touches[0], //获取第一个触点
x = Number(touch.pageX), //页面触点X坐标
y = Number(touch.pageY); //页面触点Y坐标
//判断滑动方向
if (y - startY<0) {
console.log('上滑了!');
var mainView = myApp.addView('.view-main', {domCache: true});
mainView.router.load({pageName: 'friendCircle'});
}
}catch(e){
console.log(e.message);
}
} // function touchEnd(evt){
// try{
// var touch = evt.touches[0], //获取第一个触点
// x = Number(touch.pageX), //页面触点X坐标
// y = Number(touch.pageY); //页面触点Y坐标
// //判断滑动方向
// if (y - startY<0) {
// console.log('上滑了!');
// }
// }catch(e){
// console.log(e.message);
// console.log("end");
// }
// } //绑定事件
function bindEvent(){
document.addEventListener('touchstart',touchStart,false);
document.addEventListener('touchmove',touchMove,false);
// document.addEventListener('touchend',touchEnd,false);
} bindEvent();

参考:http://blog.csdn.net/bbsyi/article/details/52108599

最新文章

  1. 关于VS中文件属性的解释
  2. 多线程socket编程示例
  3. jquery的ajax()函数传值中文乱码解决方法介绍
  4. MS WORD 表格自己主动调整列宽,自己主动变美丽,依据内容自己主动调整
  5. c++ 概念及学习/c++ concept&amp;learning(三)
  6. mysql日期加减问题
  7. Window下 Qt 编译MySQL驱动(居然用到了动态库格式转换工具)
  8. Java语言程序设计基础篇第10版第5章习题答案
  9. vim删除.swp
  10. postgresql数据库varchar、char、text的比较
  11. Docker的基本组成
  12. Sword protobuf学习一
  13. windows下使用RedisCluster集群简单实例
  14. spring boot 之使用mapstruct
  15. 关于VS 工具箱灰色,不可用的解决方案
  16. 用isNaN函数来判断是否只能输入正负数字
  17. 《火星救援》NASA惊现lisp
  18. 对selenium自动化框架重构
  19. bloom filter + murmurhash
  20. jsp另外五大内置对象之response-操作重定向

热门文章

  1. eNSP——实现OSPF与ACL综合实验
  2. TypeScript(二)使用Webpack搭建环境
  3. Stream知识点总结及源码阅读
  4. 综述论文翻译:A Review on Deep Learning Techniques Applied to Semantic Segmentation
  5. 1.IO的演进
  6. AVR单片机教程——随机点亮LED
  7. Authorization
  8. ASP.NET MVC 5 伪静态之支持*.html路由
  9. [A]System.Web.WebPages.Razor.Configuration.HostSection 无法强制转换为 [B]解决办法
  10. linux的scp命令可以在linux服务器之间复制文件和目录