Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/402.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 从iframe检测滑动手势_Javascript_Iframe_Windows 8_Windows Store Apps_Winjs - Fatal编程技术网

Javascript 从iframe检测滑动手势

Javascript 从iframe检测滑动手势,javascript,iframe,windows-8,windows-store-apps,winjs,Javascript,Iframe,Windows 8,Windows Store Apps,Winjs,我正在使用windows应用商店开发(windows 8)中的HTML/Javascript在IFrame中加载本地HTML文件。我正在尝试从Iframe获取刷卡事件 我试过这个&。我搁置了包含一个div元素的鼠标滚轮场景。 因为它不起作用 我的代码: <body> <iframe id="iframe_Id" src="split.html" style="height:768px; width:1366px;" onload="Load();"></i

我正在使用windows应用商店开发(windows 8)中的HTML/Javascript在IFrame中加载本地HTML文件。我正在尝试从Iframe获取刷卡事件

我试过这个&。我搁置了包含一个div元素的鼠标滚轮场景。 因为它不起作用

我的代码:

<body>
    <iframe  id="iframe_Id" src="split.html" style="height:768px; width:1366px;" onload="Load();"></iframe>
</body>
我为所有事件创建了函数。但在我的IFrame中滑动时,不会引发事件。
我是在这里组织的。我需要用刷卡。请帮我解决这个问题。

您应该将
放入
块中,如下所示:

<body>
   <div id="watch">
       <iframe id="iframe_Id" src="split.html" style="height:768px;
       width:1366px;" onload="Load();">
       </iframe>
   </div>
</body>


然后在
div#watch
中查看滑动,而不是
iframe
,因为触摸事件将在DOM中,而不是在iframe中。

如果split.html是本地文件,则应在
iframe
中侦听事件。然后可以使用
parent.postMessage()
与主机/父HTML页面进行通信


或者,您也可以调查Windows 8.1中HTML/JavaScript应用程序的可用性。

首先,我为回复太晚而道歉。我试图只听Iframe中的事件。但是我不知道
Parent.postMessage()
。我是Javascript新手。你可以分享任何源链接,其中有简短的描述,这是有关我的情况。谢谢&我想澄清一件事,那就是
网络视图仍然有一些限制,比如禁用缩放功能。因此,它不适用于我的情况,现在我正在为“倾听来自IFrame的事件”工作。我会试过后再联系你。这真的有必要吗?为什么要在一个新的div里而不是在尸体上寻找一击呢?@Natuu我按照你的建议做了。它不起作用。我可以在div.上刷一下。。但不是Iframe
<body>
   <div id="watch">
       <iframe id="iframe_Id" src="split.html" style="height:768px;
       width:1366px;" onload="Load();">
       </iframe>
   </div>
</body>