How to fix“Miss a drag as we are waiting for WebCore's response for touch down”

前端 未结 3 436
自闭症患者
自闭症患者 2021-01-01 12:06

I am developing a webView based android application and was trying to capture the touch events. however it is not working and i saw this message in the log:

3条回答
  •  一向
    一向 (楼主)
    2021-01-01 12:56

    For me the only way I could get this to function was to attach the event directly so it is fired before the webCore. addEventListenter was too late for me and the event stalled at the webCore and did not bubble up. This is on a Galaxy note with Android 4.0.4

    This is how I fixed it in my instance:

    var myDiv = document.createElement("div");
    myDiv.className = "myClass";
    myDiv.id = "myId";
    myDiv.setAttribute("data-open","false");
    myDiv.ontouchmove = function(e) {
      //e is touch event, this is myDiv                     
      e.preventDefault();
      //e.changedTouches[0].pageX
      //http://www.w3.org/TR/touch-events/#idl-def-TouchEvent
    };
    

提交回复
热议问题