简体   繁体   English

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

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

I have installed iframe-resizer on my site ( http://www.healthfitchiro.com/alternate-login ) which is mostly working as intended except: 1) it does not appear to work at all on mobile, in any capacity. 我已经在我的网站( http://www.healthfitchiro.com/alternate-login )上安装了iframe-resizer,该网站通常可以按预期运行,但以下情况除外:1)它似乎在任何容量的移动设备上都无法正常工作。 2) When you click somewhere inside the iframe, the page grows in length. 2)当您在iframe中单击某个位置时,页面的长度会增加。 Each click causes it to grow further and it does not shrink back. 每次点击都会使其进一步增长,并且不会缩回。 Here is my page code: 这是我的页面代码:

<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>

My questions: why is the growing phenomenon happening? 我的问题:为什么这种现象正在发生? How do I get this to work when viewed on mobile? 在移动设备上观看时,如何使它正常工作? Since I will be navigating inside the iframe, do I need to include iframeResizer.contentWindow.min.js on every page that will be navigated to or just the first page that is loaded? 由于我将在iframe中进行导航,因此是否需要在要导航到的每个页面上或仅在加载的第一页上包含iframeResizer.contentWindow.min.js Also, I guess this isn't critical but when I attempt to use the jQuery method it does not work: $('#lcembed').iFrameResize(); 另外,我猜这不是很关键,但是当我尝试使用jQuery方法时,它不起作用: $('#lcembed').iFrameResize(); It will not resize and the iFrame height appears to only be a few pixels tall. 它不会调整大小,并且iFrame的高度似乎只有几像素高。 Only iFrameResize(); iFrameResize(); by itself works functionally. 本身在功能上起作用。 Why is this happening? 为什么会这样呢?

The growing phenomenon is caused by a size mismatch between the iframe height and the iframe's body height. 增长现象是由iframe高度和iframe的身体高度之间的大小不匹配引起的。 If you remove the min-height: 101%; 如果删除min-height: 101%; from your body css it won't keep growing. 从您的身体CSS不会持续增长。

I couldn't reproduce the mobile malfunction, in Chrome on Android it looked the same as my desktop browser. 我无法重现移动设备的故障,在Android上的Chrome浏览器中,该外观与我的桌面浏览器相同。

If you are navigating to other pages within the iframe, then yes you will need to include the content script in each page. 如果要导航到iframe中的其他页面,则可以,您需要在每个页面中包含内容脚本。 It has to make a call to the parent frame, which cannot happen without the script. 它必须调用父框架,没有脚本就无法发生。

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

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