点击iPad无法获得位置和容器信息 [英] Can't get Position&Container Infomation by Click the iPad

查看:162
本文介绍了点击iPad无法获得位置和容器信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在chrome或Safari浏览器中,当我选择页面上的文本时,我可以通过 window.getSelection()获取Selection-info,并且它也适用于iPad 。
但是当我点击浏览器时,我会得到一个 window.getSelection(isCollapsed == true),其中包含有关位置和容器的完整信息。在iPad中它只是告诉你选择isCollapsed但位置信息是 0 null

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.

当你点击iPad时,任何人都知道如何获取容器和位置信息?

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

推荐答案

基本上使用触摸事件你可以做到这一点。这不仅仅是选择,而是您使用的手指数量。它适用于几乎所有手机上的iPhone上的iPad。为触摸事件设置处理程序后,您可以轻松映射它们以触发点击事件或执行其他操作。

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.

这篇关于点击iPad无法获得位置和容器信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆