JS Click on the page other places to close the pop-up layer

Source: Internet
Author: User
Keywords Web page production Ajax javascript
Tags ajax click close content display document html http

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

<html xmlns= "http://www.w3.org/1999/xhtml" >

<head>

<meta http-equiv= "Content-type" content= "HTML; charset=gb2312 "/>

<title>jquery Pop-up layer effect </title>

<meta content= "Web effects, special effects code, JQUERY,CSS special effects, JS code, advertising slides, picture switching" name= "keywords"/>

<style>

. black_overlay{

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);

}

. white_content {

Display:none;

Position:absolute;

top:10%;

left:10%;

width:80%;

height:80%;

BORDER:16PX solid lightblue;

Background-color:white;

z-index:1002;

Overflow:auto;

}

. white_content_small {

Display:none;

Position:absolute;

top:20%;

left:30%;

width:40%;

height:50%;

BORDER:16PX solid lightblue;

Background-color:white;

z-index:1002;

Overflow:auto;

}

</style>

<script type= "Text/javascript" >

Eject hidden layer

function Showdiv (show_div,bg_div) {

document.getElementById (Show_div) style.display= ' block ';

document.getElementById (Bg_div) style.display= ' block ';

var bgdiv = document.getElementById (Bg_div);

Bgdiv.style.width = Document.body.scrollWidth;

Bgdiv.style.height = $ (document). Height ();

$ ("#" +bg_div). Height ($ (document). Height ());

};

Close the pop-up layer

function Closediv (SHOW_DIV,BG_DIV)

{

document.getElementById (show_div). style.display= ' None ';

document.getElementById (bg_div). style.display= ' None ';

};

</script>

</head>

<body>

<a onclick= "Showdiv (' mydiv ', ' fade ')" > Construction station Teaching Network </a>

<!--background layer div-->

<div id= "mydiv" class= "White_content" >

<div style= "text-align:right; Cursor:default; height:40px; " >

<span style= "font-size:16px onclick=" closediv (' mydiv ', ' fade ') "> Close </span>

</div>

For the moment, I still like the pop-up layer that I've transformed. I also use this in my project.

</div>

</body>

</html>

Related Article

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.