onClick event in android webview too slow

后端 未结 2 839
刺人心
刺人心 2021-01-20 23:22

I\'ve got the feeling that javascript itself is pretty fast in an andorid webview, but there is a long delay between touching an element and the onclick event beeing fired.

相关标签:
2条回答
  • 2021-01-20 23:57

    I guess I've found the answer...

    If you take a look at jQuery mobile, you'll find a tap event. This works instantly - exactly as I need it.

    Looking deeper into the source, I've found that the tap event uses a mousedown ....

    0 讨论(0)
  • 2021-01-21 00:14

    This is a known 'issue' related to 300ms due to user tapping/zooming at display:

    http://updates.html5rocks.com/2013/12/300ms-tap-delay-gone-away

    In the near future, this seems to be solved, in static sized layouts, adding information at header. But the actual webkit webview version does not have/consider this option.

    In my case, the solution was use Tappy lib:

    https://github.com/filamentgroup/tappy

    Just import it, and bind to each element that has an click event, and you will see the difference.

    Just one more point: I adjusted the timer to 100000ms (default:1000ms) to avoid event repetition in some specific cases.

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