Touchstart事件未在iframe iOS 6中触发 [英] Touchstart event is not firing inside iframe iOS 6

查看:215
本文介绍了Touchstart事件未在iframe iOS 6中触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在IOS 6中选择文本时遇到问题。在iOS 6中, touchstart 事件未在iframe内部触发。在iOS 5上,此功能正常。

I have a problem while selecting the text in IOS 6.The touchstart event is not firing inside an iframe while in iOS 6. On iOS 5 this is working fine.

推荐答案

我也有同样的问题但只在我的一些iframe中。为什么只有其中一些,我不知道。

I also had the same problem but only in some of my iframes. Why only some of them, I don't know.

但我设法通过在touchstart事件中明确地拥有一个事件监听器来使事件在所有事件中一致地触发包含iframe的文档的上下文。

But I managed to get the event firing consistently in all of them by explicitly having an event listener on touchstart events in the context of the document containing the iframes.

因此,为包含iframe的文档添加以下代码是我的解决方法。

So adding the following code for the doc containing the iframe was the workaround for me.

function dummy() {
    // console.log("A bug? Where?");
}

addEventListener("touchstart", dummy, false);

这篇关于Touchstart事件未在iframe iOS 6中触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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