简体   繁体   English

插件iframe-resizer获取parentIFrame

[英]plugin iframe-resizer get the parentIFrame

I'm using the jQuery plugin: http://plugins.jquery.it/project/jquery-iframe-resizer 我正在使用jQuery插件: http : //plugins.jquery.it/project/jquery-iframe-resizer

OK for resize between 2 different domains. 单击确定两个不同的域之间的大小。 My enablePublicMethods option is to true. 我的enablePublicMethods选项为true。

But i need to get the ID frame in my page contained. 但是我需要在我的页面中包含ID框架。 I the plugin example, it's ok but by a click: 在插件示例中,没关系,但单击即可:

<a href='#' onclick="if ('parentIFrame' in window) window.parentIFrame.close();return false;">Close</a>

Test on the 'parentIFrame' in window working just on the onclick event. 测试仅在onclick事件上运行的'parentIFrame' in window'parentIFrame' in window When i try to get on the load, the parentIFrame is unknown: 当我尝试增加负载时,不知道parentIFrame:

$( window ).load(function() {
  if ('parentIFrame' in window){ 
       console.log("OK"); 
       console.log(parentIFrame.getId();
  }
});

How get the parentIFrame objet without click ?? 如何不单击而获得parentIFrame对象?

You need to wait until the iFrame first resizes, before that method becomes available. 您需要等到iFrame首次调整大小后,该方法才可用。

During page load you need to poll to see if parentIFrame exists, once it's setup, you can then call getID(); 在页面加载期间,您需要轮询以查看parentIFrame是否存在,一旦设置,就可以调用getID();。

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

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