给div添加遮罩层,js给页面添加遮罩层

 给id为p_div的元素添加遮罩层

<div style="background:#000000;height:280px;position:relative;" id="p_div">

 

        <video id="videoLive" style="" controls="controls" autoplay="autoplay" width="100%" height="280" poster="https://i.ys7.com/static/images/6abdc484fbf44ebf833c7af00be57aab/b722c3dc934db2e78c772aa7b6f6a167/1.jpeg">
            <source src="http://vshare.ys7.com:80/hcnp/540540642_1_2_1_0_183.136.184.7_6500.m3u8" type="video/mp4">

 

        </video>

     <!--ID为zcdiv的为遮罩层-->

 

        <div id="zcdiv" style="position:absolute;top:0;left:0;z-index:10000;width:100%;height:100%;background:#000000;">
            <div style="position:relative;width:100%;height:100%;">
                <div id="loading" style="position:absolute;top:37%;left:50%;margin-left:-60px;height:55px;width:150px;border:0px solid red;padding:0;color:white;">
                    <img src="img/Loading.gif" width="50" />
                    <span style="display:inline-block;position:relative;top:-18px;">正在加载</span>
                </div>
            </div>           
        </div>

 

    </div>

 <button type="button" οnclick="show()" >显示隐藏</button>
    <div id="msg2"></div>

JS代码控制显示隐藏

 function show() {
            if ($("#zcdiv").is(":hidden")) {
                $("#zcdiv").show();
                $("#msg2").html("显示");
            } else {
                $("#zcdiv").hide();
                $("#msg2").html("隐藏");
            }
        }

var CoverLoadingObj = {
            //显示遮罩层
            showLoading:function(msg) {
                if (msg == undefined || msg == null || msg == "") {
                    msg = "正在加载";
                }
                $(document).find("body").append("<div id=\"zc34ASDEOP\" style=\"text-align:center;width:100%;height:100%;position:fixed;top:0;left:0;background: rgba(0, 0, 0, 0.3);z-index:50000;display:table;\"><div style=\"display: table-cell; vertical-align: middle;\"><div id=\"zcMsg\" style=\"width:120px;height:40px;line-height:40px;background:#FFFFFF;margin:0 auto;box-shadow: 0px 0px 2px #000;text-align:center; \"><img src=\"/Theme/images/loading.gif\" style=\"margin-right:3px;position:relative;top:-2px;\" />" + msg + "</div></div></div>");
            },
            //关闭遮罩层
            closeLoading:function () {
                if ($("#zc34ASDEOP") != undefined && $("#zc34ASDEOP") != null) {
                    $("#zc34ASDEOP").remove();
                }
            }
    };

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

王焜棟琦

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值