touchend event in ios webkit not firing?

后端 未结 4 972
滥情空心
滥情空心 2021-02-04 16:08

I\'m trying to implement a menu for a ios webkit based app in which the user touches/clicks and holds a menu button (\'.menu_item\'), after 500ms the sub menu opens (div.slide_u

相关标签:
4条回答
  • 2021-02-04 16:37

    For your "touchmove" event;

    If you do not want to do anything on touchmove:

    return false;
    

    If you with to prevent the default behavior but execute some code on touchmove:

    e.preventDefault();
    

    This issue is more pronounced on iPads.

    0 讨论(0)
  • 2021-02-04 16:43

    If you don't need to use multitouch data, you may keep using mouseup on ipad.

    further reading: http://developer.apple.com/library/IOS/#documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html

    0 讨论(0)
  • 2021-02-04 16:44

    touchend does not fire because touchcancel has fired earlier. If you want full touch evens handling you need to call

    e.preventDefault()
    

    in the callback of "touchmove" event, otherwise when a touchmove event occurs if the browser decides that this is a scroll event it will fire touchcancel and never fire touchend.

    0 讨论(0)
  • 2021-02-04 16:52

    Maybe it's a bit late to answer. This event will never fire, because touch events fire on the very element on which touchstart happened. So, to do what you want to, one solution is to use document.elementFromPoint method, to which you will send appropriate x and y coordinates.

    0 讨论(0)
提交回复
热议问题