简体   繁体   中英

Click vs touch on mobile devices in JS

When comparing the following 2 event listeners:

$("#button").click(myFunc);

and

$("#button").on("touchstart", myFunc);

Why is a touchscreen device's response to the click event slower than the touch event, what determines this ie the order of operations.

You don't have a click until your finger releases its pressure. The click is a consequence of touchend , not touchstart .

Most often there's also a delay between the touchend and the click so that a double tap can be detected (then a click event isn't sent).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM