How to dynamically resize iFrame in Firefox?

时光毁灭记忆、已成空白 提交于 2019-12-22 12:39:29

问题


I used the solution stated on this page to resize the iFrame depending on the content:

Resizing an iframe based on content

And it works perfectly, except in Firefox. In Firefox, the other content is cut-off but once you keep on refreshing the page, the browser will slowly reveal the rest of the content. I saw someone replied that this is the solution to the problem:

Use jQuery to get the body height in framed.html (FF issue, body kept growing): var height = $(document.body).height();

However, I don't know where to put that line of code. Do I insert it somewhere within the 3 snippets of scripts on the original solution? If so, where do I put it?


回答1:


In www.bar.net/framed.html: Use jQuery to get the body height in framed.html (FF issue, body kept growing):

change following code

// What's the page height?
     var height = document.body.scrollHeight;

with

var height = $(document.body).height(); 



回答2:


I already solved it. In case somebody else might be encountering the same problem, I used the code on the web page below which is slightly different from the link I gave above:

http://solidgone.org/Set-IFRAME-height-based-on-size-of-remotely-loaded-content



来源:https://stackoverflow.com/questions/4789689/how-to-dynamically-resize-iframe-in-firefox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!