2013-09-28 68 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>