我正在使用 jqModal 创建一个使用 ajax 的模式窗口,其中包含要填写的表单。父窗口仅包含大约半页数据,因此不包含滚动条。当模态窗口加载时,表单溢出页面,底部不可见。创建一个在需要时包含滚动条的模态窗口或将滚动条添加到父窗口以便整个模态可以上下滚动的最佳方法是什么?代码如下:
Javascript:
$(document).ready(function () {
$("#AddGameTypeWindow").jqm({
ajax: '/maintenance/AddGameType.html',
modal: true,
trigger: "#NewGameTypeButton"
});
});
HTML:
<body>
<div id="AddGameTypeWindow" title="Add Game Type" style="display:none"></div>
<div id="AddLocationWindow" class="jqmWindow" style="width:640px;height:480px"></div>
<table>
<tr>
<td>Game Type</td><td><select id="GameType"><option value="0"></option></select> <button id="NewGameTypeButton" class="ui-state-default ui-corner-all"><span class="ui-icon ui-icon-plus"></span></button></td>
</tr>
最佳答案
如果你的模态是<div id="AddGameTypeWindow" title="Add Game Type" style="display:none"></div>
尝试给它一个固定的高度并添加 overflow:auto
按照他的风格,这样如果模态内容大于您的固定高度,滚动条就会出现。
关于javascript - jqModal 溢出了我的页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17139456/