首页 > 安卓设备上touchend事件的bug

安卓设备上touchend事件的bug

在一个元素上同时绑定了touchend,touchstart,和touchmove事件,
通过设置参数move的值来判断touchend时触发某个事件,touchemove时不触发,
但是在ios设备上表现良好,安卓设备上就不会触发touchend,或经常语言连续点击才会触发,
查了资料在touchstart事件中,阻止冒泡,touchstart正常触发,但是会禁用浏览器的scroll事件,不能滑动了,
有什么好的解决方案么?

    
  var move = false;   //判断是否滑动
  $(document).delegate(".card_list li", "touchend", function (event) {
    if(!move)
    {
        //执行其他方法
    }
    return false;
  });
  $(document).delegate(".card_list li","touchmove",function(){
    move = true;
  })
  $(document).delegate(".card_list li","touchstart",function(){
    move = false;
    event.preventDefault();
  })

https://github.com/chemzqm/iscroll
Android 2.x + ios 6.x 表现良好


这是一个 Android 内置浏览器的 bug,存在于 Android 4.0 和 4.4 版本里,已经被很多人反馈过了。

你可以试试 mobiletouch 这个库,它在触屏事件上层做了封装,你可以用 swipeStartswipeProgressswipe 来替代 touchstart, touchmovetouchend.

【热门文章】
【热门文章】