[Front-end]-full screen mask, front-end full screen mask

Source: Internet
Author: User

[Front-end]-full screen mask, front-end full screen mask

In front-end development, the display of a pop-up layer is usually accompanied by the display of a mask layer.

1 <! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN" 2 "http://www.w3.org/TR/html4/loose.dtd"> 3 

The above code is a simple DEMO code for the mask layer.

When the page does not have a scroll bar, the requirements can be met. However, when the page has a scroll bar, you will find that the above processing method does not meet the full screen mask.

The following uses javascript to implement the full screen mask when the page contains a scroll bar.

Here we will use two methods in the previous article: scrollWidth and scrollHeight. The processing method is as follows:

1 var floatBg = document.getElementById("float-bg");2 floatBg.style.width= document.body.scrollWidth + "px";
floatBg.style.height = document.body.scrollHeight + "px";

In this way, the full screen mask can be implemented regardless of whether the page contains a scroll bar.

 

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.