我asp.net页面上工作。在母版页我有这样一个div:如何在屏幕和叠加/背景的中心弹出式全屏幕高
<body id="page1" >
<form id="form2" runat="server">
<div id="content">
<!-- this is popup light grey show -->
<div class="darkenBg" id="popupBackground" style="display:none;"></div>
<!-- content -->
<div class="greenBox2 popUpWin" id="companySigninPopup" style="display:none;">
<div class="topWrap">
<!-- popup window -->
</div>
<div class="botWrap">
<div class="corner-bottom-left"> </div>
<div class="border-bottom"> </div>
<div class="corner-bottom-right"> </div>
</div>
</div>
</div>
</div>
</div>
我显示它是这样的:
function ShowHomePagePopup(popupId) {
$("#" + popupId).show();
$("#popupBackground").show();
$('#popupBackground').height(800);
$("#page1").addClass('hideScrollbars');
}
CSS是这样的:
html, body {
height:100%;
margin:0px;
}
.darkenBg { /*added this div after body*/
background: url(/images/blackBg.png);
position:absolute;
z-index:30;
width:100%;
height:100%;
bottom:0px;
}
.popUpWin {
position:absolute;
z-index:31;
width:500px;
left:50%;
margin:200px 0 0 -250px
}
.hideScrollbars {
overflow: hidden;
}
#content {
background:url(/images/bg.gif) top left repeat-x #fff;
overflow:hidden;
padding-bottom:20px;
}
- 当弹出窗口,它是水平居中的,但垂直在顶部,因此它位于屏幕中间的顶部。
- 的重叠,浅灰色的背景,是指popupBackground只有10%的屏幕高度的宽度虽然是100%。我怎样才能让它100%高?
http://jqueryui.com/dialog/ - >模态对话框 –
我不能使用jQuery UI的对话,因为我有我的自定义弹出式设计,虽然我使用jQuery来显示我的自定义弹出与.show方法。 – DotnetSparrow
@DotnetSparrow - 请参阅本[解决方案](http://stackoverflow.com/questions/3202583/how-to-center-align-pop-up-div-using-javascript) –