问题
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