遮罩层代码
css .mask{ position: absolute; top: 0px; background-color: #000000; z-index: 1000; left: 0px; filter: alpha(opacity=60); opacity: 0.5; -moz-opacity: 0.5; display: none; } html <div id="mask" class="mask"></div> js function show(){ mask.style.height = screen.height+"px"; mask.style.width = screen.width+"px"; mask.style.display = "block"; } function hide(){ mask.style.display = "none"; }
jquery版本
css .mask { position: absolute; top: 0px; filter: alpha(opacity=60); background-color: #777; z-index: 1002; left: 0px; opacity:0.5; -moz-opacity:0.5; } html <div id="mask" class="mask"></div> js //兼容火狐、IE8 //显示遮罩层 function showMask(){ $("#mask").css("height",$(document).height()); $("#mask").css("width",$(document).width()); $("#mask").show(); } //隐藏遮罩层 function hideMask(){ $("#mask").hide(); }
不积跬步,无以至千里,不积小流,无以成江海!
实践则生,空谈则死!