Super simple method, also need not write what Judge browser height, width what.
Here are two ways to do it. One is placed on the same page as the IFRAME, and one is placed on the test.html page.
Be careful not to put the wrong place.
iframe Code, Note to write the ID
- < iframe src ="test.html" ID ="main" width ="The " height ="+" frameborder ="0" scrolling ="Auto" ></iframe>
jquery Code 1:
- // Note: The following code is placed in the test.html call
- $ ( window . parent document find ( "#main" load ( function () {
- var Main = $ (window. Parent . Document ). Find ("#main");
- var Thisheight = $ (document). Height ()+ - ;
- Main . Height (thisheight);
- });
jquery Code 2:
- // Note: The following code is placed on the same page as the IFRAME call
- $ ("#main"). Load (function() {
- var = $ ( this ). contents (). find ( "body" height () + 30
- $ (this). Height (mainheight);
- });