undefinedfix
Sign in

Click delay of native JS mobile terminal

0x30c4 edited in Mon, 16 May 2022

It's said on the Internet that there will be a delay of 300ms for the click event on the mobile terminal, but I used my iPhone to test why there is no delay for the click event, but a delay for the touchstart event? On Google browser, there is no delay in testing click and touchstart in mobile mode. Can you tell me how to make touch start on the mobile phone without delay?

3 Replies
jwillikers
commented on Mon, 16 May 2022

How do you measure it

User
commented on Mon, 16 May 2022

Further tests show that if the callback function contains an alert statement, touchstart, touchmove, and touchend will all be delayed. If the alert statement is removed, there will be no delay. What do you mean?

Mahdi
commented on Mon, 16 May 2022
  • The 300ms delay is caused by the browser detecting whether there is a double-click operation. If there is no double-click within 300ms, the browser will respond to the click operation;
  • Fastclick is a library to reduce 300 latency. You can learn about it.
lock This question has been locked and the reply function has been disabled.