Based on the JS implementation pop-up a hidden div window body page becomes gray and cannot be edited _javascript tips

Source: Internet
Author: User
Tags visibility

When you need to implement the following figure, click on the service score, a Service Rating window appears to fill in the relevant form information

But this will let us Open the service scoring interface can also click on the body main interface of the shopping cart links, this is wrong, so we can use cascading style sheet to specify the perimeter div z-index below the current service Rating form page, can not be clicked, as follows:

/* Define a div to cover the entire page, the z-index of this div is larger than the body, less than the service rating div
/#temp {
  background-color: #000;
  opacity:0.3;
  width:100%;
  height:100%;
  Z-index:2;
  Visibility:hidden;
}
/* Rating Div, its z-index max (when displayed)/
#mark {
 Background-color:rgb (255,255,255);
 width:400px;
 height:250px;
 Z-index:3;
 Visibility:hidden;
}
* * Contains the service rating, shopping cart, such as div * * * *
#main {
 Background-color:rgb (255,255,255);
 width:100%;
 height:100%;
 z-index:1;
}
<div id= "Temp" ></div>
<div id= "Mark" ></div>
<div id= "main" ></div>
<a id= "link" ><i> click me to Cascade </a>
<script>
 window.onload = function () {
  document.getElementById ("link"). onclick = function () {
   document.getElementById ("temp"). Style.visibility = " Visible ";
   document.getElementById ("Mark"). style.visibility = "visible";
  }
 }
</script>

The effect chart is as follows:

The above is a small series to introduce the introduction of the JS based on the implementation of a hidden div window of the body page into a gray and can not be edited, I hope to help everyone, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.