Way 1:

//Note:The following code is called on the same page as the iframe
$("#iframeid"). load (function () {
    var mainheight=$(this) .contents (). find ("body"). height () + 30;
    $(this) .height (mainheight);

Way 2:

//Note:The following code is called in the child page referenced by the iframe
$(window.parent.document) .find ("#iframeid"). load (function () {
    var main=$(window.parent.document) .find ("#iframeid");
    var thisheight=$(document) .height () + 30;
    main.height (thisheight);
  • Previous JS implementation of digital format thousandths mutual conversion method
  • Next Threejs learning orthogonal projection camera