这张图片说明了我的问题:
我认为这是来自 Sohtanaka 的弹出脚本,所以你看到的是一个弹出窗口。CSS看起来像这样:
#fade { /*--Transparent background layer--*/
display:none; /*--hidden by default--*/
background:#000000;
position:fixed;
left:0;
top:0;
width:100%;
height:100%;
opacity:.80;
z-index:9999;
}
.popup_block{
display:none; /*--hidden by default--*/
background:#ffffff;
padding:20px;
border:20px solid #dddddd;
float:left;
position:absolute;
top:50%;
left:50%;
z-index:99999;
/*--CSS3 Box Shadows--*/
-webkit-box-shadow:0px 0px 20px #000000;
-moz-box-shadow:0px 0px 20px #000000;
box-shadow:0px 0px 20px #000000;
/*--CSS3 Rounded Corners--*/
-webkit-border-radius:10px;
-moz-border-radius:10px;
border-radius:10px;
font-size:12px;
height:625px;
}
img.btn_close {
float:right;
margin:-55px -55px 0 0;
}
/*--Making IE6 Understand Fixed Positioning--*/
*html #fade {
position:absolute;
}
*html .popup_block {
position:absolute;
}
和javascript:
$(document).ready(function(){
//When you click on a link with class of poplight and the href starts with a #
$('a.poplight[href^=#]').click(function() {
var popID = $(this).attr('rel'); //Get Popup Name
var popURL = $(this).attr('href'); //Get Popup href to define size
//Pull Query & Variables from href URL
var query= popURL.split('?');
var dim= query[1].split('&');
var popWidth = dim[0].split('=')[1]; //Gets the first query string value
//Fade in the Popup and add close button
$('#' + popID).fadeIn().css({ 'width': Number( popWidth ) }).prepend('<a href="#" class="close"><img src="../images/close_pop.png" class="btn_close" title="Close Window" alt="Close" /></a>');
//Define margin for center alignment (vertical + horizontal) - we add 80 to the height/width to accomodate for the padding + border width defined in the css
var popMargTop = ($('#' + popID).height() + 80) / 2;
var popMargLeft = ($('#' + popID).width() + 80) / 2;
//Apply Margin to Popup
$('#' + popID).css({
'margin-top' : -popMargTop,
'margin-left' : -popMargLeft
});
//Fade in Background
$('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
$('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn(); //Fade in the fade layer
return false;
});
//Close Popups and Fade Layer
$('a.close, #fade').live('click', function() { //When clicking on the close or fade layer...
$('#fade , .popup_block').fadeOut(function() {
$('#fade, a.close').remove();
}); //fade them both out
return false;
});
});
第一张图片是当我使用下面链接的 CSS 时。一切都在工作,右上角的紧密交叉在那里并且正在工作。问题是,我在弹出窗口上做了一个固定的高度,根据链接到弹出窗口的 ID,里面的东西可能更多,也可能更少。因此,固定高度并不总是足够的,您可以在第一张图片的底部看到,其中内容实际上超出了窗口框架。
好吧,然后我尝试使用溢出:自动(我知道我应该溢出-y 用于两侧的滚动条,但另一张图片只是溢出,所以请耐心等待;)),我得到了另一张图片。然后我在窗口内得到一个滚动条,我可以轻松滚动以查看其他内容,因为它应该是(再次,忽略 x 滚动条)。但是,不幸的是,不是关闭十字按钮不想像以前那样显示,而是隐藏在边框后面。
我尝试了一些方法,将 javascript 中的按钮包含在一个 div 中,然后定位它,但这似乎不像我那样工作。