Scroll on fixed position div
The entire popup-div is visible, and when I scroll vertically, it follows.
Only half of the popup-div is visible, and when I scroll vertically it follows, but it's impossible to view the second part of the popup-div. How can this be achieved?
css code:
.popup
{
position:fixed;
z-index:9002;
background开发者_运维知识库-color:#FFFFFF;
border:solid 1px #000000;
top: 20%;
left: 20%;
overflow: auto;
}
.popupbackground
{
background-color:#111;
opacity:0.65;
filter:alpha(opacity=65);
position:fixed;
z-index: 500;
top:0px;
left:0px;
width: 100%;
height: 100%;
}
I'm working with ASP.NET, if the code-behind is needed to answer this question I will provide it.
I have read about solutions such as setting the overflow parameter to auto or scroll, but haven't gotten that to work.
Update follows below:
Now the popup is scrollable vertically as wanted, but only if the scrollbar is visible horizontally.
Here, it's not possible to scroll vertically because the scrollbar is not visible, and scrolling horizontally in the browser just forces the popupdiv to follow along.
try this code (the content of the pupup is just for testing):
<html>
<head>
<style>
.popup
{
position:fixed;
z-index:9002;
background-color:#FFFFFF;
border:solid 1px #000000;
top:10%;
left: 20%;
overflow: auto;
height:80%;
width:40%;
}
.popupbackground
{
background-color:#111;
opacity:0.65;
filter:alpha(opacity=65);
position:fixed;
z-index: 0;
top:0px;
left:0px;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div class="popupbackground">
</div>
<div class="popup">
a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />
a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />
a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />
a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />
a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />
a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />
a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />
a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />
a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />
a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />a<br />
</div>
</body>
</html>
specify the height of the popup to 80% and top:10%
精彩评论