html 中弹出遮罩层设置

<!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>

  

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

时间: 2024-10-16 18:20:22

html 中弹出遮罩层设置的相关文章

弹出遮罩层后禁止滚动效果

弹出遮罩层后,手指在手机上上下滑动 遮罩层下的页面出现滑动.下面代码解决这个问题 (1)触摸后不产生事件 //遮罩层禁止滚动 $('.searbox_mask_byInteg').bind("touchmove", function (e) { e.preventDefault(); }); (2)body不出现滚动条 $("body,.main").height($(window).height()).css({ "overflow-y": &

弹出遮罩层水平垂直居中

很多时候,登陆注册的时候,会需要弹出一个层,且后面有一层遮罩蒙版层,让后面不可点击状态 且需要这个弹出层是水平垂直居中显示的 固定宽高的水平垂直居中好实现 这里的弹出层,是随着内容撑开的,不固定宽高 ---------------------------- ------------------------------ .wrap .pop { width: 80%; height: auto; background: #FFFFFF; border: 1px #000 solid; -moz-b

小程序实现弹出遮罩层模态框

<view bindtap='showRule'>点击弹出模态框</view> <!--遮罩层--> <view class="ruleZhezhao {{isRuleTrue?'isRuleShow':'isRuleHide'}}"> <view class='ruleZhezhaoContent'> <image src='/images/zijia.png' class="select">

jQuery弹出遮罩层效果完整示例

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-

JQuery弹出层,点击按钮后弹出遮罩层,有关闭按钮

<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>jQuery弹出层效果</title> <meta content="网页特效,特效代码,jQuery,css特效,Js代码,广告幻灯,图片切换" name="keywords" /> <meta content="

JS 点击按钮后弹出遮罩层,有关闭按钮

<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>jQuery弹出层效果</title> <meta content="网页特效,特效代码,jQuery,css特效,Js代码,广告幻灯,图片切换" name="keywords" /> <meta content="

判断是不是微信浏览器,如果是将弹出遮罩层提示在右上角浏览器中打开(一般用于下载东西)

<!DOCTYPE html> <html lang="zh-cn"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-wid

JS弹出遮罩层

// create div var mask=document.createElement("div"); mask.id="mask"; mask.style.position="absolute"; mask.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=4,opacity=25)";//IE的不透明设置 mask.style.opacity=0.4

弹出遮罩层后禁止底部页面滚动

stop(){ var mo=function(e){e.preventDefault();}; document.body.style.overflow='hidden'; document.addEventListener("touchmove",mo,false);//禁止页面滑动 }, /***取消滑动限制***/ move(){ var mo=function(e){e.preventDefault();}; document.body.style.overflow='';/