码迷,mamicode.com
首页 > Web开发 > 详细

html 中弹出遮罩层设置

时间:2020-04-04 18:55:25      阅读:77      评论:0      收藏:0      [点我收藏+]

标签:one   count   Fix   oop   设置   html   rip   button   jquery   

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>host</title>
    <style>
    	<!-- 隐藏设置-->
        .hide{
            display: none;
        }
        <!-- 遮罩层样式-->
        .shade{
            position: fixed;
            top:0;
            right: 0;
            left: 0;
            bottom: 0;
            background: black;
            opacity: 60%;
            z-index: 100;
        }
        <!-- 弹出层样式-->	
        .add_modal{
            position: fixed;
            height: 300px;
            width: 400px;
            top: 100px;
            left: 50%;
            z-index: 101;
            border: 1px solid red;
            background: white;
            margin-left: -200px;
        }
    </style>
</head>
<body>
<h1>主机信息(对象)</h1>
<div>
    <input id = "add_host" type="button" value="添加" />
</div>
<table border="1">
    <thead>
    <tr>
        <th>序号</th>
        <th>主机名</th>
        <th>IP</th>
        <th>端口</th>
        <th>业务线</th>
    </tr>
    </thead>
    <tbody>
    {% for row in v1 %}
        <tr hid="{{ row.nid }}" bid="{{ row.b_id }}">
            <td>{{ forloop.counter }}</td>
            <td>{{ row.hostname }}</td>
            <td>{{ row.ip }}</td>
            <td>{{ row.port }}</td>
            <td>{{ row.b.caption }}</td>
        </tr>
    {% endfor %}
    </tbody>
</table>
<div class="shade hide">
</div>
<div class="add_modal hide">
    <form action="/cmdb/host" method="post">
        <div class="group">
            <input type="text" placeholder="主机名" name="hostname"/>
        </div>
        <div class="group">
            <input type="text" placeholder="IP" name="ip"/>
        </div>
        <div class="group">
            <input type="text" placeholder="端口" name="port"/>
        </div>
        <div class="group">
            <select name="b_id">
                {% for row in b_list %}
                    <option value="{{ row.id }}">{{ row.caption }}</option>
                {% endfor %}
            </select>
        </div>
        <input type="submit" value="提交">
        <input id="cancel" type="button" value="取消">
    </form>
</div>
<script src="../../static/jquery-3.4.1.js"></script>
<script>
    $(function () {
        $(‘#add_host‘).click(function () {
            $(‘.shade,.add_modal‘).removeClass(‘hide‘);
        });
        $(‘#cancel‘).click(function () {
            $(‘.shade,.add_modal‘).addClass(‘hide‘);
        });
    })
</script>
</body>
</html>

  

html 中弹出遮罩层设置

标签:one   count   Fix   oop   设置   html   rip   button   jquery   

原文地址:https://www.cnblogs.com/xzlive/p/12633040.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!