Selecting text in mobile Safari on iPhone

前端 未结 4 617
闹比i
闹比i 2020-12-13 02:41

I\'m trying to make it easy for an iphone user to copy some text to the clipboard in mobile safari. As in the usual \"touch-hold-copy\". There is a specific bit of text I wa

4条回答
  •  鱼传尺愫
    2020-12-13 03:17

    Try ontouchstart instead of onfocus. Onfocus fires approx. 500ms after ontouchend, same as onclick, onmousedown, and onmouseup. See https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html#//apple_ref/doc/uid/TP40006511-SW7 for more details on mouse events.

提交回复
热议问题