Front-end development, many times a pop-up display will be accompanied by a mask layer display.
1 <!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en"2 "Http://www.w3.org/TR/html4/loose.dtd">3 <HTMLxmlns= "http://www.w3.org/1999/xhtml">4 <Head>5 <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" />6 <title>Full Screen Matte</title>8 </Head>9 Ten <Body> One <style> A . FLOAT-BG{ - width:100%; - Height:100%; the Background-color:#000; - Opacity:. 6; - Filter:Alpha (opacity=60); - position:Absolute; + Left:0; - Top:0; + Z-index:1100; A } at </style> - <Divclass= "FLOAT-BG"ID= "FLOAT-BG"> </Div> - </Body> - </HTML>
The above code is a simple demo code for masking layers.
The page does not have scroll bars to meet the requirements. But when the page has scrollbars, you will find that the above processing does not satisfy the full screen mask.
The following is a way of combining JavaScript to implement a full-screen matte when the page contains scrollbars.
Here will be used in the previous article two methods: Scrollwidth,scrollheight. The related processing methods are as follows:
1 var FLOATBG = document.getElementById ("FLOAT-BG"); 2 floatbg.style.width= document.body.scrollWidth + "px";
This enables full-screen masking regardless of whether the page contains scroll bars.
Front-Full Screen matte