简体   繁体   中英

Javascript event fired on long press/tap on tablets

I am developing a website using RWD priciples and it is supposed to self adjust and work in both desktop and in tablets, and eventually in Mobiles as well.

I know in android development we can catch a long tap event and do some actions.

But my question is that, is it possible to do it in HTML/HTML5 and javascript?

Basically looking for a predefined event which gets fired on long press on html elements.

I have gone through This and understood all the alternatives suggested. Looking if anything new has been introduced in HTML5.
Thanks

Might check out pointer.js from Mozilla. Apparently somewhat standardizes the touch/ mouse events into a single event type. Probably better than using timeouts, I'd imagine.

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