简体   繁体   English

获取Iframe的高度和调整大小事件

[英]Get height of Iframe and the resize event

I need to get the height of the iframe . 我需要获取iframe的高度。 And also i need to get a resize event so that i could change the height dynamicaly when the iframe loaded content changes. 而且我还需要获取一个调整大小事件,以便在iframe加载的内容发生更改时可以动态更改高度。 Till now am success in getting the height but no resize event. 到现在为止成功获得高度但没有调整大小的事件。

    $("iframeID").load(function(){
    $("iframeID").height($("iframeID").contents().find("body").height());
      $("iframeID").resize(function(){
       //this doesn't fire up
      });
   });

It's not easy to get the height from the iframe content on resize. 从调整大小的iframe内容获取高度并不容易。 You really need access to the child page. 您确实需要访问子页面。 I found this on really helpfull.But you need to include iframeResizer.contentWindow.min.js fil in child page and it will work like charm. 我发现对您确实很有帮助。但是您需要在子页面中包含iframeResizer.contentWindow.min.js fil,它会像魅力一样工作。 I have used it and it worked my like charm for me. 我用过它,它对我来说就像是魅​​力。

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

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