jquery popup window, lock background method

Source: Internet
Author: User

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >
<title> New Page </title>
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<meta name= "description" content= "Boolean education http://www.itbool.com"/>
<script src= "Http://libs.baidu.com/jquery/1.10.2/jquery.min.js" ></script>
<!--<script type= "Text/javascript" src= "Background.js" ></script>-

<!--jquery section--
<script type= "Text/javascript" >
$ (function ()
{
$ ("#but"). Click (function () {
Gets the height of the current page
var height=$ (' body '). CSS (' height ');
Append masking layer Elements
$ (' body '). Append
("<div id=background style= ' height:" +height+ "';></div>")

Show pop-up box

$ ("#hide"). Slidedown ("slow");
})

$ ("#close"). Click (function () {


Close the Popup box
$ (this). Closest (' div '). Hide ();
$ ("#background"). Remove ();

})
$ (". Text"). Click (function () {
Alert ($ (this). attr (' id '));
})

})

</script>
<!--CSS section--
<style type= "Text/css" >
#background {
left:0px;
top:0px;
width:100%;
opacity:0.7;
Z-index:8;
Background:gray;
Position:absolute;
}
#hide p{

Color: #ffffff;
}
</style>
<!--HTML section--
<body style= "magin:0px 0px;p adding:0px 0px;height:700px" >
<div id= "test" style= "width:100%; Height:700px;background: #dddddd ">
<button id= "But" > button </button>
<button class= "text" id= "T1" > Test button 1</button>
<button class= "text" id= "t2" > Test button 2</button>
<button class= "text" id= "T3" > Test button 3</button>
The <p> class is rich in appearance </p>
The <p> class is rich in appearance </p>
The <p> class is rich in appearance </p>
The <p> class is rich in appearance </p>
The <p> class is rich in appearance </p>
The <p> class is rich in appearance </p>
<div id= "Hide" style= "Width:300px;height:200px;top:100px;left:200px;position:absolute;background:gray;z-index : 9;display:none;box-shadow:50px 50px 25px #888888; border:5px Solid Orange
">
<button id= "Close" style= "Float:right" > Close </button>
<p> is still rich in class capacity </p>
<p> is still rich in class capacity </p>
<p> is still rich in class capacity </p>
</div>

</div>
</body>

jquery popup window, lock background method

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.