Iframe中的滚动条在内容之前结束。那么有没有办法将滚动条高度设置为内容的高度

问题描述 投票:0回答:1

那么,有人可以在这里帮助我,当滚动条结束时,有大网页正在削减70%左右

码:

</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';
}
javascript css iframe scrollbar
1个回答
0
投票

我使用js函数来设置高度,它工作。但我的问题是settimer在iframe加载之前设置了高度:

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

    iframe.style.height = container.offsetHeight + 'px';            
}
© www.soinside.com 2019 - 2024. All rights reserved.