根据juery CSS点击一个标签弹出一个遮罩层的简单示例

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <script src="JS/JavaScript/jquery-1.7.2.min.js"></script> 
    <style type="text/css">
        .Calculator_box-opened {
             100%;
            height: 100%;
            position: fixed;
            top: 0px;
            left: 0px;
            overflow-y: visible;
            display: none;
            background-color: #000;
            opacity: 0.8;
            filter: alpha(Opacity=80, FinishOpacity=50, Style=0, StartX=0, StartY=0, FinishX=100, FinishY=100);
            z-index: 1099;
        } 
        .Calculator_box {
            padding: 0px;
             520px;
            margin: 100px auto;
            text-align:center;
            background-color: #FFF;
            position: relative;
        } 
    </style>

    <script type="text/javascript">
        $(document).ready(function () {
            var speed = 600;//动画速度
            $("#dj").click(function (event) {//绑定事件处理
                event.stopPropagation();
                $("#Calculator").show(speed);//动画显示
            });
            //单击除空白区域外的空白区域就隐藏
            $(document).click(function () {
                if (!$(event.srcElement).is(".Calculator_box,.Calculator_box *")) {
                    $("#Calculator").hide(speed);
                }
            });
        });
    </script>

</head>
<body>
    
    <input type="button" value="点击我弹出层吧" id="dj" />
    <div class="Calculator_box-opened" id="Calculator">
        <div class="Calculator_box">
             <span style="color:red; font-size:16px">大家好,我是弹出层哟!</span>
        </div>
    </div>
</body>
</html>

  简单示例比较容易懂!

原文地址:https://www.cnblogs.com/mo-xi/p/TC_com.html