我有一个页面,其中包含两个div并排放置的两个iframe。我要删除的第二个iframe上有一个滚动条,以便iframe与浏览器滚动条一起滚动。带有不需要的滚动条的iframe包含一个gridview,并且当数据变得长于浏览器高度时,滚动条就会出现。
<div data-dx-role="view" data-dx-name="Index" data-dx-title="Home" style="height: 100%">
<div data-dx-target-placeholder="content">
<div id="treeframe" class="ui-widget-content" style="position: absolute; overflow-x: scroll; width: 20%; overflow: hidden; bottom: 0px; top: 0px; left: 0px; z-index: 1">
<iframe class="iframeformat" height="1100" style="width: 100%; overflow: auto;" id="ifrmtree" src="./SiteTree.aspx"></iframe>
</div>
<div id="contentframe" class="mobform" style="position: relative; overflow: hidden; top: 0px; width: 100%%; height:100%" aria-haspopup="False">
<iframe id="ifrmlogin" class="embed-responsive-item" src="./DashboardHome.aspx" style="height: 1100px; overflow: hidden; width: 100%; border: none;"></iframe>
</div>
</div>
</div>
.aspx带有Gridview的页面:
<dx:ASPxGridView ID="ASPxGridView1" runat="server" Style="align-content: center;height:100%; text-align: center; overflow:hidden;" OnHtmlDataCellPrepared="ASPxGridView1_HtmlDataCellPrepared" CssClass="auto-style1" RightToLeft="False" Width="100%">
<Settings VerticalScrollBarMode="Hidden"/>
<SettingsPager Mode="ShowAllRecords" PageSize="30">
<PageSizeItemSettings ShowAllItem="True">
</PageSizeItemSettings>
</SettingsPager>
</dx:ASPxGridView>
答案 0 :(得分:1)
This Javascript solution几年前对我有所帮助,但只有iframe
的内容位于同一域中才有效:
<script>
function resizeIframe(obj) {
obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
}
</script>
<iframe src="..." frameborder="0" scrolling="no" onload="resizeIframe(this)" />