我想设置#bodyHider全屏。我尝试了这段代码:
#bodyHider{
position:absolute;
width:100%;
height:100%;
background:#000;
opacity: 0.7;
filter: alpha(opacity=70); /* For IE8 and earlier */
z-index:10000;
}
Run Code Online (Sandbox Code Playgroud)
HTML代码:
<div id="bodyHider"></div>
Run Code Online (Sandbox Code Playgroud)
它有效,但是当我向下滚动时,我看到的#bodyHider是页面顶部。即使滚动页面,我也希望整个div整个屏幕。
这就是你想要的。
#bodyHider{
position:fixed;
top:0;
width:100%;
height:100%;
background:#000;
opacity: 0.7;
filter: alpha(opacity=70); /* For IE8 and earlier */
z-index:10000;
}
Run Code Online (Sandbox Code Playgroud)