判断touchmove上下的方向

 1 var a = 0;
 2 $(window).on('touchstart' , function(e){
 3     a = e.touches[0].screenY;
 4 });
 5 $(window).on('touchmove' , function(e){
 6     var disY = e.touches[0].screenY - a;
 7         if(disY > 0){
 8           alert('向下')  
 9         }else{
10            alert('向上')
11         }
12 }

 

posted @ 2014-12-12 14:28  vivi.wang  阅读(1615)  评论(0编辑  收藏  举报