[英]Enable scrolling on a single div?
我的布局看起來像這樣:
<html>
<head>
stuff here
</head>
<body>
<div id="master">
<div id="toolbar">
<input type="text" id="foo">
</div>
<div id="content">
a whole bunch of content in here
</div>
</div>
</body>
</html>
'#master'是jquery UI對話框的容器。 我希望'#content'div的內容可以滾動,但'#toolbar'不能滾動。 這是否適用於jquery UI的對話框?
只需使用css規則:
#content { overflow: auto; height: [desired height] }
如果模態具有動態高度,則可能需要使用jQuery。 在這種情況下,在open
模態時,您可以設置內部容器高度。 就像是:
open: function(){
var modalHeight = $('#master').height();
$('#content').height(modalHeight - [footer and title]);
}
使用CSS為#content
div提供一個設置高度和一個寬度,並在該div上設置CSS屬性overflow: auto
。 如果內容超出高度,您將獲得滾動條。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.