3

I'm looking for a way to detect a long press in javascript in a UIWebView.

For other reasons (don't ask) I need to do this in javascript (not detect in objective-c and fire a javascript method).

So basically use these:

document.getElementById('touchable').addEventListener('touchstart', function(ev) {
}

and so forth (touchend, touchmove, touchcancel, etc).

But would like to use some standard or proven code that then determines if it is a long press. In other words the code has to check to see if there is another touch or recently ended touch (user was doing a two finger zoom or something), detect whether they moved their finger "too much" and thus are panning, not pressing, etc.

Seems like a lot of conditions and a lot that can be done differently, so it would be great if there was a standard way to do this, but I'll take any approaches that work.

4

0 回答 0