Child page re-modifies parent page iframe height after asynchronous operation execution

Source: Internet
Author: User

The sub-page joins the AJAX Global approach:

<script language="javascript" type="text/javascript" >        $ (document). Ready (function () {/// Asynchronous request loading complete             $.ajaxsetup ({                 'complete': function () {                    // Modify IFRAME Height                      resizeparentiframe (        )             ;}); </script>

To modify the iframe height:

//Child page re-modifies the parent page iframe heightfunction Resizeparentiframe () {varRealheight =0; if(Navigator.userAgent.indexOf ("Firefox") >0|| Navigator.userAgent.indexOf ("Mozilla") >0|| Navigator.userAgent.indexOf ("Safari") >0|| Navigator.userAgent.indexOf ("Chrome") >0) {//Mozilla, Safari,chrome, ...Realheight = Window.document.documentElement.offsetHeight + *; } Else if(Navigator.userAgent.indexOf ("MSIE") >0) {//IE        varBodyscrollheight = Window.document.body.scrollHeight + +;//get the body of the scrollheight        varElementscrollheight = Window.document.documentElement.scrollHeight +1;//get the scrollheight of documentelementRealheight = Math.max (Bodyscrollheight, elementscrollheight);//take the bigger one.}Else{//Other BrowsersRealheight = window.document.body.scrollHeight + window.document.body.clientHeight +1; }    if(Realheight < -) {Realheight= -; }    if($("#ifm", window.parent.document). is("iframe")) {        $("#ifm", window.parent.document). Height (realheight); }}

Reference: http://www.cnblogs.com/shenyixin/archive/2013/03/05/2943892.html

The child page re-modifies the parent page iframe height after the asynchronous operation is performed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.