html5 touch事件实现触屏页面上下滑动(一)

2020-04-24 19:07:57易采站长站整理

            }     
  
            function touchEnd(e){//手指离开屏幕   
              e.preventDefault();                      
              aboveY=parseInt(inner.style.top);//touch结束后记录内部滑块滑动的位置 在全局变量中体现 一定要用parseInt()将其转化为整数字;   
  
            }//   
             document.getElementById("outer").addEventListener(‘touchstart’, touchSatrt,false);     
             document.getElementById("outer").addEventListener(‘touchmove’, touchMove,false);     
             document.getElementById("outer").addEventListener(‘touchend’, touchEnd,false);     
    </script>  
</body>  
  
</html>  

原文:http://www.cnblogs.com/leinov/p/3701951.html