《遮蔽层的隐藏块》
隐藏块样式及脚本:
#hidebg {
background-color: #ccc;
filter: alpha(opacity=50);
-moz-opacity: 0.5;
-khtml-opacity: 0.5;
opacity: 0.5;
position: absolute;
left: 0;
top: 0;
width: 100%;
z-index: 3;
}
<div id="hidebg"></div>
<script>
$(function(){
show();
});
function show() //显示隐藏层和弹出层
{
var hideobj = document.getElementById("hidebg");
hidebg.style.display = "block"; //显示隐藏层
hidebg.style.height = document.body.clientHeight + "px"; //设置隐藏层的高度为当前页面高度
document.getElementById("shop_notice").style.display = "block"; //显示弹出层
}
function closed() //去除隐藏层和弹出层
{
document.getElementById("hidebg").style.display = "none";
document.getElementById("shop_notice").style.display = "none";
}
</script>