我在 iframe 上设置了一个模式对话框,使用 JQuery UI 显示一个单独的页面。当页面内容高度大于对话框高度时,滚动条会出现在 Firefox 中,虽然有点靠右,但当我使用 Internet Explorer 8 或 Chrome 时,它们不会显示。我的代码如下:
库调用者代码:
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
在单独的 .js 文件中打开对话框的代码:
function showRegDialog(url) {
idNro = Math.floor((Math.random() * 1500) + 1);
$(function () {
var horizontalPadding = 0;
var verticalPadding = 0;
$('<iframe id="externalSite' + idNro + '" scrolling="no" frameborder="0" padding="0" margin="0" style="overflow:auto" class="externalSite" src="' + url + '" />').dialog({
open: function () {
$(this).siblings('.ui-dialog-titlebar').remove();
},
title: false,
autoOpen: true,
width: 750,
height: 700,
modal: true,
resizable: false,
draggable: false,
autoResize: false,
overlay: {
opacity: 0.5,
background: "black"
}
}).width(550).height(700);
});
}
打开页面有:
<style type="text/css">
html {overflow : visible}
</style>
<body>
<ul>
<li><a href="javascript:showRegDialog('view_edit.aspx?c=1');"> Edit<img src="images/btn/edit_pv.png" align="Absbottom" border="0"/></a>
</li>
</ul>
<!--...-->
</body>
单独的内容页面具有:
<style type="text/css">
.viewEdit
{
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px
}
.viewEditForm
{
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px
}
.viewEditMainDiv
{
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px
}
</style>
<body class="viewEdit" style="overflow-x:hidden">
<form id="form1" class="viewEditForm">
<div class="viewEditMainDiv">
<!--...-->
</div>
</form>
</body>
如何让这些滚动条在 IE 和 Chrome 上显示?我已经做了相当多的研究,似乎overflow:visible
或者overflow:auto
会做到这一点,但这对我来说还没有奏效。如果是这样,它可能是 jquery-ui 版本的错误我该如何修复它?
非常感谢您的时间和帮助。