0

When running Javascript code on a mobile device, the response time of every button is very slow. At first I thought the click event handlers in my code were just very inefficient code, until I visited other sites and realized that 1) the delay happens on every site 2) the delay happens before the click event is fired.

The delay is split into two roughly equal (to the naked eye) parts--before the keydown and between keydown and keyup. After keyup, the click event is fired without any visible (to the naked eye) delay.

Is there anything I can do to make the keydown happen faster or last shorter, whether by changing my device's settings or by optimizing some block of javascript code?

Isaac Betesh
  • 2,935
  • 28
  • 37
  • No. I believe what you're seeing is the fact that mobile browsers must delay press/release events to test for a long-press or a touch-drag operation. Subsequently, these events are not instantaneous on phones/tablets. – qJake Jul 03 '13 at 19:24
  • @SpikeX, Where can I read more about this? – Isaac Betesh Jul 03 '13 at 20:55
  • Here's an example for you: http://stackoverflow.com/questions/9071346/is-there-a-way-to-remove-the-clicking-lag-on-mobile-touch-devices – qJake Jul 04 '13 at 04:09

1 Answers1

1

SpikeX's comments on the question eventually led me to Alex Black's google-fastbutton javascript library, which directly solves this issue.

It implements the solution described in the example SpikeX linked to.

Isaac Betesh
  • 2,935
  • 28
  • 37