弹出窗口时使用css禁用背景

Mil*_*ton 11 html css css3

当弹出窗口出现时,我使用下面的css代码来阻止整个页面.但它正在工作(可见页面仅涵盖了所有内容).我有一个问题,如果我的页面有滚动条意味着页面的剩余底部未被阻止程序覆盖.

.parentDisable
        {
            z-index: 99999;
            width: 100%;
            height: 100%;
            display: none;
            position: absolute;
            top: 0%;
            left: 0%;
            background-color: #000;
            color: #aaa;
            opacity: 0.8;
            filter: alpha(opacity=100);
        }
        #popup
        {
            width: 300;
            height: 300;
            position: relative;
            color: #000;
            top: 25%;
        }
Run Code Online (Sandbox Code Playgroud)

Abd*_*lik 13

用这个css

.parentDisable{
    position: fixed;
    top: 0;
    left: 0;
    background: #000;
    opacity: 0.8;
    z-index: 998;
    height: 100%;
    width: 100%;}

#popup{
    position: absolute;
    z-index: 999;}
Run Code Online (Sandbox Code Playgroud)

和这个HTML

<div class="parentDisable"></div>
<div id="popup">My pop up</div>
Run Code Online (Sandbox Code Playgroud)