2017-10-27 2 views
0

ので、コンテンツの高さにスクロールバーの高さを設定する方法があり、いくつかのいずれかがここで私を助けることができ、スクロールバーとして約70%削減なっている大きなWebページが終了されているコンテンツの前に終了するIframe内のスクロールバー。だから、

コード:

</div> 
    <div id="divCustomDataPreview" title="Custom Form Preview" style="background-color: #ffffff; height:580px; !important; display: none;overflow:hidden; " > 
     <iframe id='ifrCustomDataPreview' style="border: 0px; overflow:hidden !important;" scrolling="yes" width='100%' height='100%' onload='javascript:resizeIframe(this);'></iframe> 
    </div> 
    <div id="divFormCreate" title="Convert To Form" style="display: none;background-color:#FFFFFF"> 


function resizeIframe(obj) { 
    var BrowserName=BrowserDetecting().split('#')[0]; 
    if(BrowserName == "Chrome" || BrowserName == "Safari") 
     obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px'; 
    else     
     obj.style.height=obj.contentWindow.document.documentElement.scrollHeight + 'px'; 
} 
+0

スクロールバーは何ですか?なぜその要素を親の高さにしないのですか?あなたのスクロールバーが途切れないように – Pete

答えて

0

高さを設定するためにjs関数を使用していました。しかし、iframeがロードされる前に高さが設定されているため、settimerで問題が発生しました。

function resizeIframe(iframeID) { 
    var iframe = window.parent.document.getElementById(iframeID); 
    var container = document.getElementById('content'); 

    iframe.style.height = container.offsetHeight + 'px';    
} 
関連する問題