Js css implements the mask layer to overwrite other page elements with drawings and css masks.
<div style=" position: fixed; width: 100%; height: 100%; left: 0px; top: 0px; background-color: Black; z-index: 9999; filter: alpha(opacity=70); Opacity:0.7;"></div>
Z-index must be greater than the mask Element
Demo
<! Doctype html>
The CSS mask layer cannot completely mask pages.
The height: 100% indicates the height of the browser window, that is, the body you set: 100%. If the content on your page exceeds the display range in the browser window, that is, the scroll bar appears. If you pull the scroll bar, the unmasked content will appear below. You can first determine the height of your page content and the size of the browser window, and assign the maximum value to the height of the mask layer.
How does one implement a translucent mask layer after a div layer is displayed on the webpage?
Var p = document. createElement ("DIV ");
P. id = "MyAlertBoxMasker ";
P. style. position = "absolute ";
P. style. width = document. body. scrollWidth;
P.style.height?document.doc umentElement. offsetHeight;
P. style. zIndex = '20140901 ';
P. style. top = '0 ';
P. style. left = '0 ';
P. style. backgroundColor = "gray ";
P. style. opacity = '0. 5 ';
P. style. filter = "alpha (opacity = 80 )";
// Content Layer
Var p1 = document. createElement ("DIV ");
Var top = parseInt (document. body. scrollHeight) * 0.25) + document. body. scrollTop;
P1.id = "MyAlertBox ";
P1.style. position = "absolute ";
Var left;document.doc umentElement. offsetHeight/2;
Var left = 0;
P1.style. zIndex = '20140901 ';
P1.style. top = top + 'px ';
P1.style. left = left + 'px ';
P1.innerHTML = ""; // The specific HTML content of the floating layer
Document. body. appendChild (p );
Document. body. appendChild (p1 );
// The above code appears. -----------
// The following code is disabled
Document. body. removeChild (document. getElementById ('myatertboxmasker '));
Document. body. removeChild (document. getElementById ('myertbox '));