Background grayed out when scrollheight is set to the pop-up layer (compatibility issues)

Source: Internet
Author: User

1. CSSCode:

HTML, body {Height: 100%;} // when the content is small, the body cannot be filled with the whole webpage

# Vip_div
Position: absolute;
Top: 0;
Left: 0;
Width: 100%;
Display: none;
Z-index: 20;
Background-color: # c0c0c0;
Opacity: 0.6;
Filter: alpha (opacity = 60 );

2. js code:

Function Change ()


Document. getelementbyid ("vip_div"). style. Height = document.doc umentelement. scrollheight + "PX ";

// Google and Firefox cannot be displayed in full screen when the parameter document.doc umentelement. scrollheight is set to document. Body. scrollheight on Firefox or Google google Google

Document. getelementbyid ("vip_div"). style. Display = "Block ";


3. html:

<Div id = "vip_div"> </div>

<Input type = "button" onclick = "change ();"/>

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: 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.