Click the pop-up center with transparent matte Layer window:

Source: Internet
Author: User

This section describes how to click on a button to implement pop-up a center window, and this window with a translucent matte layer effect, this effect is more popular in the present, of course, there are more complex implementation, of course, the effect is more brilliant, the following code can be simple to achieve this effect.

Click the pop-up center with transparent matte Layer window:
This section describes how to click on a button to implement pop-up a center window, and this window with a translucent matte layer effect, this effect is more popular in the present, of course, there are more complex implementation, of course, the effect is more brilliant, the following code can be simple to achieve this effect.
The code is as follows:

?
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657  <!DOCTYPEhtml> <html<head<metacharset=" utf-8"<metaname="author"content="http://www.softwhy.com/"/> <title>蚂蚁部落</title<styletype="text/css"#fade {   display:none;   position:absolute;   top:0%;   left:0%;   width:100%;   height:100%;   background-color:black;   z-index:1001;   -moz-opacity:0.8;   opacity:.80;   filter:alpha(opacity=80); #light{   display:none;   position:absolute;   top:25%;   left:25%;   width:50%;   height:50%;   padding:16px;   border:3px solid orange;   background-color:white;   z-index:1002;   overflow:auto; </style<scripttype="text/javascript"window.onload=function(){    var linkbt=document.getElementById("linkbt");    var light=document.getElementById(‘light‘);    var fade=document.getElementById(‘fade‘);    var closebt=document.getElementById("closebt");    linkbt.onclick=function(){      light.style.display=‘block‘;      fade.style.display=‘block‘;       closebt.onclick=function(){      light.style.display=‘none‘;      fade.style.display=‘none‘;    </script</head<body<ahref="javascript:void(0)"id="linkbt"> 点击这里打开窗口</a<divid="light"><ahref="javascript:void(0)"id="closebt">关闭窗口</a></div<divid="fade""></div</body</html>

The above code implements our requirements, the following is a brief introduction of its implementation process.
I. Principle of implementation:
By default, masking layers and windows are invisible, and when clicked, the window and mask layer can be displayed, and the matte layer is set to semitransparent. Both of these elements use absolute positioning and the Z-index property value of the center window is greater than the mask layer, so that it can be overlaid on top of the matte layer. When you click the Close button, you can hide the mask layer and the window, which is basically the principle.

Click the pop-up center with transparent matte Layer window:

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.