Can't get Position&Container Infomation by Click the iPad

独自空忆成欢 提交于 2019-12-12 05:06:43

问题


In chrome or Safari browser, when I select the text on the page I can get the Selection-info by window.getSelection(), And it worked on iPad too. But when I just click , in browser, I will get a window.getSelection (isCollapsed==true) with full infomation about the position and container . In iPad it just tell you the selection isCollapsed but the position info is 0 or null.

Anyone have an idea how to get the container and the position info when you click in iPad?


回答1:


Basically using touch events you could do this. It is not just the selection but the number of the fingers you used too. It works on iPad on iPhones on almost every mobile. After setting your handlers for touch events you can map them easily to fire the click events or do something else.



来源:https://stackoverflow.com/questions/9475676/cant-get-positioncontainer-infomation-by-click-the-ipad

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!