Copy Code code as follows:
<!doctype HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/ Xhtml1-transitional.dtd ">
<title>jquery Simple to achieve mask layer--cloud habitat Community </title>
<script type= "Text/javascript" src= "Jquery/jquery-1.10.2.min.js" ></script>
<body>
<div ><input type= "button" onclick= "Show_www.jb51.net ()" value= "Show Mask Layer"/> Show mask layer and click upper right corner to close </div>
<div ></div>
<div > Cloud-dwelling Community </div>
<div >www.jb51.net</div>
<div >keleyi</div>
<div >www.jb51.net</div>
<div > Cloud-dwelling Community </div>
<div > Cloud-dwelling communities return to top </div>
<div >a</div>
<div >jquery</div>
<div ><a href= "http://www.jb51.net/a/bjac/6f008786225269ac.htm" target= "_blank" > Original text </a></div >
<div >www.jb51.net</div>
<div > Complete Code </div>
<div ><div id= "Donwmsg_content" >
<ul>
<li class= "ll" ><a href= "http://www.jb51.net/768f469b95b61487.htm" > Single word intermittent up-scrolling </a></li>
<li><a href= "http://www.jb51.net/a6d651710217f7a0.htm" >jquery UI modifier title Bubble </a></li>
<li><a href= "http://www.jb51.net/f0eb8c02085b10d.htm" >jquery empty textarea etc input Boxes </a></li>
<li><a href= "http://www.jb51.net/939631bb07adb4dc.htm" >jquery off light effects </a></li>
<li><a href= "http://www.jb51.net/7e8897e5ec0849e9.htm" > can change the size div layer </a></li>
</ul>
<div class= "lb" ><a href= "http://www.jb51.net/jquery/" target= "_blank" >jquery</a> <a href= "http ://www.jb51.net/javascript/"target=" _blank ">javascript</a> <a href=" http://www.jb51.net/cms/"target=" "_blank" >cms</a> </div>
</div></div>
<script type= "Text/javascript" >
$ ("<div id=" div_brg_www.jb51.net "></div>"). CSS ({
Position: "Absolute",
top:0,
left:0,
BackgroundColor: "#004400",
opacity:0.5,
zindex:300
})
. Height ($ (document). Height ())
. width ($ (document). Width ()). Hide (). Appendto ("Body")
When you need a mask.
function Show_www.jb51.net () {
$ ("#div_brg_www. Jb51.net"). Show ();
}
$ ("#close_ke" + "leyi_com"). Click (function () {
When you cancel the mask,
$ ("#div_brg_www. Jb51.net"). Hide ();
}
) </script>
</body>
There are two jquery methods used:
One, show (): If the selected element is hidden, display these elements
Grammar
$ (selector). Show (Speed,callback)
Speed
Optional. Specify the speed from which elements are hidden to full visibility. The default is "0".
Possible values:
Milliseconds (for example, 1500)
"Slow"
"Normal"
"Fast"
In the case of setting the speed, the element is gradually changing its height, width, outer margin, inner margin, and transparency as it is hidden from the fully visible process.
Callback
Optional. The function to execute after the show function has finished executing.
This parameter cannot be set unless the speed parameter is set.
Tip: If the element is already fully visible, the effect does not change unless the callback function is specified.
Note: This effect applies to elements that are hidden through jquery, or elements that declare display:none in CSS (but not for visibility:hidden elements).
Hide (): If the selected element is already displayed, the element is hidden.
Grammar
$ (selector). Hide (Speed,callback)
Speed
Optional. Specify the speed from which elements are visible to hidden. The default is "0".
Possible values:
Milliseconds (for example, 1500)
"Slow"
"Normal"
"Fast"
In the case of setting the speed, the element will gradually change its height, width, outer margin, inner margin, and transparency as it is visible to the hidden process.
Callback
Optional. The function to execute after the Hide function finishes executing.
This parameter cannot be set unless the speed parameter is set.
Tip: If the element is already fully visible, the effect does not change unless the callback function is specified.