繁体   English   中英

使用iframe调整大小工具:当我在iframe内单击时,iframe会增加,但在移动设备上也无法运行

[英]Using iframe-resizer: iframe grows when I click inside iframe, also not functioning on mobile

我已经在我的网站( http://www.healthfitchiro.com/alternate-login )上安装了iframe-resizer,该网站通常可以按预期运行,但以下情况除外:1)它似乎在任何容量的移动设备上都无法正常工作。 2)当您在iframe中单击某个位置时,页面的长度会增加。 每次点击都会使其进一步增长,并且不会缩回。 这是我的页面代码:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript" src="//healthfitcorpwell.com/wp-content/themes/healthfitcorpwell/js/iframeResizer.min.js"></script>
<style>#lcembed{width:100%}</style>
<script type="text/javascript">
document.write('<iframe id="lcembed" name="lcembed" src="https://www.healthfitcorpwell.com/lce/?url=' + document.location + '" scrolling="no" frameborder="0"></iframe>');
iFrameResize({log:true, checkOrigin:false, inPageLinks:true, sizeWidth:true});
</script>

我的问题:为什么这种现象正在发生? 在移动设备上观看时,如何使它正常工作? 由于我将在iframe中进行导航,因此是否需要在要导航到的每个页面上或仅在加载的第一页上包含iframeResizer.contentWindow.min.js 另外,我猜这不是很关键,但是当我尝试使用jQuery方法时,它不起作用: $('#lcembed').iFrameResize(); 它不会调整大小,并且iFrame的高度似乎只有几像素高。 iFrameResize(); 本身在功能上起作用。 为什么会这样呢?

增长现象是由iframe高度和iframe的身体高度之间的大小不匹配引起的。 如果删除min-height: 101%; 从您的身体CSS不会持续增长。

我无法重现移动设备的故障,在Android上的Chrome浏览器中,该外观与我的桌面浏览器相同。

如果要导航到iframe中的其他页面,则可以,您需要在每个页面中包含内容脚本。 它必须调用父框架,没有脚本就无法发生。

暂无
暂无

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

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