在使用html5做在手机上显示轮播图片的效果时突然遇到touchmove事件在touchstart事件之后只触发了一次touchmove之后和touchend一起触发了一次,咦,这是怎么回事?怎么不和mousemove一个道理呢,最后查了查资料是因为没设置事件阻止引起的

             //绑定事件
        function bindEvent() {  
                document.getElementById("divid").addEventListener('touchstart', touchSatrtFunc,false);  
                document.getElementById("divid").addEventListener('touchmove', touchMoveFunc,false);  
                document.getElementById("divid").addEventListener('touchend', touchEndFunc,false);  
         }  
 function touchSatrtFunc(evt)
         {
           var e = evt.touches[0];
         }
         function touchMoveFunc(evt)
         {
             var e = evt.touches[0];
            clientX_start = e.screenX;
            evt.preventDefault();//就是这句
         }
         function touchEndFunc(evt)
         {
         }
touchstart:  // 手指放到屏幕上的时候触发 
touchmove:  // 手指在屏幕上移动的时候触发 
touchend:  // 手指从屏幕上拿起的时候触发 
touchcancel:  // 系统取消touch事件的时候触发
//返回的参数
client / clientY:// 触摸点相对于浏览器窗口viewport的位置 
pageX / pageY:// 触摸点相对于页面的位置 
screenX /screenY:// 触摸点相对于屏幕的位置 
identifier: // touch对象的unique ID 

 


相关文章:

  • 2021-07-03
  • 2021-04-27
  • 2021-12-22
  • 2021-05-09
  • 2021-10-04
  • 2021-12-18
  • 2021-08-08
  • 2022-01-02
猜你喜欢
  • 2022-12-23
  • 2021-09-18
  • 2022-12-23
  • 2021-12-18
  • 2021-11-22
  • 2021-07-09
  • 2022-01-16
相关资源
相似解决方案