2013-09-28 55 views

回答

0

试试这个代码

<script type="text/javascript" > 
$(document).ready(function(){ 
     window.setInterval(resizeIframeHeader, 2000); 
    }); 

    var pastHeight = 0; 

    function resizeIframeHeader() { 
    var currentHeight = document.body.scrollHeight; 
    var currentWidth = document.body.scrollWidth; 
    if (currentHeight != pastHeight){ 
    pastHeight = currentHeight; 
    parent.postMessage(document.body.scrollHeight, '*'); 
    } 
if (currentWidth != pastWidth){ 
    pastHeight = currentWidth ; 
    parent.postMessage(document.body.scrollWidth, '*'); 
    } 
} 
</script> 
0

这里是为您的网页小提琴:Fiddle

<body> 
Your page content 
</body>