响应式弹出窗

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        span {
            cursor: pointer;
        }

        .body {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: #000000;
            opacity: 0.3;
            display: none;
        }

        .center {
            position: absolute;
            width: 50%;
            height: 50%;
            left: 25%;
            right: 25%;
            top: 25%;
            bottom: 25%;
            background-color: #ffffff;
            border: 5px solid palegoldenrod;
            display: none;
        }

        .colse {
            position: absolute;
            right: 0;
            top: 0;
            font-size: 23px;
            font-weight: bold;
        }
    </style>
    <script src="../jquery-1.11.1.min.js"></script>
</head>

<body>
    <span class="up">点击我</span>
    <div class="body">
        <div class="center">
            <div class="colse">X</div>
            <!-- 登录 -->
            <p>
                <span>账号</span>
                <span><input type="text" placeholder="请输入账号"></span>
            </p>
            <p>
                <span>密码</span>
                <span><input type="password" placeholder="请输入密码"></span>
            </p>
        </div>
    </div>
    <script>
        $(function () {
            $('.up').unbind('click').bind('click', function () {
                $('.center').css('display', 'block');
                $('.body').css('display', 'block');
                $('.up').css('display', 'none');
            })
            $('.colse').unbind('click').bind('click', function () {
                $('.body').css('display', 'none');
                $('.center').css('display', 'none');
                $('.up').css('display', 'block');
            })
        })
    </script>
</body>

</html>

猜你喜欢

转载自blog.csdn.net/SQY_candy/article/details/82229504