This article describes the method of jQuery to simply implement the height of iframe adaptation according to the content of the page. Share it for your reference, as follows:
Method 1:
//Note: The following code is called in the same page as the iframe$("#iframeId").load(function () { var mainheight = $(this).contents().find("body").height() + 30; $(this).height(mainheight); });
Method 2:
//Note: The following code is called in the subpage of the iframe reference$().find("#iframeId").load(function () { var main = $().find("#iframeId"); var thisheight = $(document).height() + 30; (thisheight); });
For more information about jQuery, please visit the special topic of this site:Summary of jQuery operation iframe skills》、《Summary of jQuery extension skills》、《Summary of commonly used plug-ins and usages of jQuery》、《Summary of jQuery drag and drop special effects and skills》、《Summary of jQuery table operation skills》、《Summary of Ajax usage in jquery》、《Summary of common classic effects of jQuery》、《Summary of jQuery animation and special effects usage"and"Summary of jquery selector usage》
I hope this article will be helpful to everyone's jQuery programming.