简体   繁体   English

在IFRAME中添加子HTML之后,父HTML jQuery插件无法正常工作

[英]Parent HTML jquery plugins not working after adding child HTML in IFRAME

I have a html called parent.html and another html called child.html . 我有一个名为parent.html的html和另一个名为child.html html。 The child html serves as the body for the parent and i included it in the parent like this : 子html充当父代的主体,我将其包含在父代中,如下所示:

<div id ="body_Menu" style="padding-top:1em;">
    <iframe src="D:\\bodice\\bodiceMenu\child.html" width="1220" height="600" scrolling="no">
    </iframe>
</div>

Now both the parent and child use jquery plugins. 现在,父级和子级都使用jquery插件。 A common library is the traditional jquery.js : 一个常见的库是传统的jquery.js

<script type="text/javascript"    src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

which has been included in both the parent and child as both of them have javascript/jquery animations/functions that need to run . 它已包含在父级和子级中,因为它们都具有需要运行的javascript / jquery动画/功能。

The problem is that, after including the child in iframe , the parent javscript has stopped running. 问题在于,在将子级包含在iframe中之后,父级javscript已停止运行。 I don't see any error in the console as well. 我也没有在控制台中看到任何错误。 But when both the html s are loaded separately, they run perfectly . 但是,当两个html分别加载时,它们可以完美运行。

I am using these two plugins : 我正在使用这两个插件:

<script src="jquery-css-transform.js" type="text/javascript"></script>
<script src="jquery-animate-css-rotate-scale.js" type="text/javascript"></script>

What is the problem here ? 这里有什么问题 ? How can i rectify it ? 我该如何纠正? Any help is appreciated . 任何帮助表示赞赏。

As i can see, your iframe take its source from a local file (D:\\bodice\\bodiceMenu\\child.html). 如我所见,您的iframe来自本地文件(D:\\ bodice \\ bodiceMenu \\ child.html)。 If you display your page from a web server (even a local server on your machine), you won't be authorized to display your iframe due to security reason on most browsers (this is the case in chrome for example). 如果您从网络服务器(甚至是计算机上的本地服务器)显示网页,则由于大多数浏览器的安全性原因,您将无权显示iframe(例如chrome)。 Is that what you're trying to do ? 那是你想做的吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM