jQ遮罩层小demo
< ! 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>
< title> 弹出层< / title>
< script src= "http://www.jq22.com/jquery/jquery-1.7.1.js" type= "text/javascript" > < / script>
< style type= "text/css" >
. zzk{
position: fixed;
width: 100 % ;
height: 100 % ;
left: 0 ;
top: 0 ;
z- index: 980 ;
background- color: rgba ( 0 , 0 , 0 , 0.8 ) ;
}
. kks{
position: fixed;
width: 800 px;
height: 546 px;
left: 50 % ;
top: 50 % ;
margin- top: - 273 px;
transform: translateX ( - 50 % ) ;
z- index: 990 ;
background- color: rgba ( 255 , 255 , 255 , 1 ) ;
}
< / style>
< script type= "text/javascript" >
$ ( function ( ) {
hideZzc ( ) ;
} )
var showZzc = function ( ) {
$ ( ".zzc" ) . show ( ) ;
}
var hideZzc = function ( ) {
$ ( ".zzc" ) . hide ( ) ;
}
< / script>
< / head>
< body>
< div class = "xs" >
< input type= "text" >
< button onclick= "showZzc()" > 点击展示遮罩层< / button>
< / div>
< div class = "zzc" >
< div class = "kks" >
< input type= "text" / >
< ul>
< li> 1 < / li>
< li> 2 < / li>
< ul>
< / div>
< div class = "zzk" onclick= "hideZzc()" > < / div>
< / div>
< / body>
< / html>