Front-Full Screen matte

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.