简体   繁体   English

使用 iframe-resizer 动态调整 iFrame 大小时出错

[英]Error when Dynamically Resizing iFrame using iframe-resizer

I am trying to dynamically resize the height of an iFrame using " iframe-resizer " However this is not working as expected.我正在尝试使用“ iframe-resizer ”动态调整 iFrame 的高度,但这并没有按预期工作。

I have added this code to my display HTML document我已将此代码添加到我的显示 HTML 文档中

<script src="js/iframeResizer.min.js"></script>
<iframe id="myIframe" src="l3-main.html"></iframe>
<script>
   iFrameResize({ log: true }, '#myIframe')
</script>  

and this code to my iframe content HTML document并将此代码添加到我的 iframe 内容 HTML 文档中

<script type="text/javascript" src="js/iframeResizer.contentWindow.min.js"></script>

as well as this in my css file以及我的css文件中的这个

iframe {
    width: 1px;
    min-width: 100%;
    border: none;
}

However, I am getting this error when viewing the page in the Console:但是,在控制台中查看页面时出现此错误:

Uncaught ReferenceError: iFrameResize is not defined未捕获的 ReferenceError:未定义 iFrameResize

Searching though stackoverflow and other resources I have not yet been able to find a solutions, thanks in advance to anyone who has sugestions.通过stackoverflow和其他资源搜索我还没有找到解决方案,提前感谢任何有建议的人。

maybe you dont have install min.js code.也许你没有安装 min.js 代码。 You use code like code in documentation, but you dont use a <style> with 1px width and min width 100%.您在文档中使用类似代码的代码,但您不使用宽度为 1 像素且最小宽度为 100% 的<style>

The code in the question is correct.问题中的代码是正确的。 I would check that the JS file is loading ok.我会检查 JS 文件是否加载正常。

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

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