JQuery UI 计算对话框内内容的大小以避免对话框中出现滚动条
我将一些内容放入 JQuery UI 对话框中。 HTML 如下:
<div id="dialog">
<div id="content">
<div id="scrollable">
<div id="data">
<ul>
<li/>
<li/>
....
</ul>
</div>
</div>
<div id="footer">
</div>
</div>
</div>
JQuery 代码如下:
$('#dialog').dialog({
width : 500,
height: 300
})
如您所见,对我来说重要的大小是主容器(对话框)的大小。我希望内容位于对话框内,而对话框中没有滚动条。内容有两部分,数据本身始终具有垂直滚动条和始终可见的页脚(这部分已经已解决) 解决方案应该调整内容 div 的大小。我尝试了几次计算,考虑到对话框内的可用高度是:
var height=$('#dialog').height()-$('.ui-dialog-titlebar').height();
var dataHeight = height-$('#footer').height();
I'm putting some content inside a JQuery UI dialog. The HTML is as follows:
<div id="dialog">
<div id="content">
<div id="scrollable">
<div id="data">
<ul>
<li/>
<li/>
....
</ul>
</div>
</div>
<div id="footer">
</div>
</div>
</div>
And the JQuery code is sth like:
$('#dialog').dialog({
width : 500,
height: 300
})
As you see, the sizing that is important to me is the sizing of the main container, the dialog. I want the content to feet inside the dialog without scrollbars in the dialog. The content has two pieces, the data itself that always has a vertical scroll bar and a footer that is always visible (this part has already been solved)
The solution should resize the content div. I have tried several calculations taking into account that the available height inside the dialog is:
var height=$('#dialog').height()-$('.ui-dialog-titlebar').height();
var dataHeight = height-$('#footer').height();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论