当前位置:网站首页>H5,为页面添加遮罩层,实现类似于点击右上角在浏览器中打开
H5,为页面添加遮罩层,实现类似于点击右上角在浏览器中打开
2022-07-02 09:41:00 【System.out.print】
代码实现,可以直接复制生成html文件演示
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.js"></script>
<title>遮罩层</title>
</head>
<style>
.content{
width: 100%;
height: 100%;
background-color: red;
}
.show-mask-btn {
background: rgb(4, 208, 71);
padding: 5px 10px;
border-radius: 5px;
cursor: pointer;
}
.show-mask-btn p {
font-size: 12px;
font-weight: 400;
color: #ffffff;
}
.mask-box {
position: fixed;
min-height: 100vh;
background-color: rgba(0,0,0,.5);
opacity: 0.5;
display:none;
z-index: 999;
width: 100%;
}
.hint-txt {
width: 100%;
color: #ffffff;
text-align: center;
height: 35px;
line-height: 35px;
}
</style>
<body class="white-gradient-bg">
<!-- 蒙版/遮罩层 -->
<div class="mask-box" id="download-box">
<div class="hint-txt">1、点击右上角图标</div>
<div class="hint-txt">2、选择 在浏览器中 打开</div>
</div>
<!-- 你的内容 -->
<div class="content">
<div class="doshow-mask-btn" id="show-mask-btn">
<p>点击查看遮罩层</p>
</div>
</div>
</body>
</html>
<script>
$('#show-mask-btn').click(function () {
$('.mask-box').css('display','block');
})
</script>这里有些需要注意的地方:
1、遮罩层div,一定要放在所有元素最上方。如下图标红色框框的实例

边栏推荐
- PX4 Position_ Control RC_ Remoter import
- Basic usage of MySQL in centos8
- The computer screen is black for no reason, and the brightness cannot be adjusted.
- ESP32音频框架 ESP-ADF 添加按键外设流程代码跟踪
- HOW TO ADD P-VALUES TO GGPLOT FACETS
- Homer forecast motif
- How to Create a Nice Box and Whisker Plot in R
- On April 17, 2022, the five heart matchmaker team received double good news
- 通讯录的实现(文件版本)
- 电脑无缘无故黑屏,无法调节亮度。
猜你喜欢

TDSQL|就业难?腾讯云数据库微认证来帮你

RPA advanced (II) uipath application practice

YYGH-BUG-05

亚马逊云科技 Community Builder 申请窗口开启

JS -- take a number randomly from the array every call, and it cannot be the same as the last time

PYQT5+openCV项目实战:微循环仪图片、视频记录和人工对比软件(附源码)

HOW TO CREATE AN INTERACTIVE CORRELATION MATRIX HEATMAP IN R

Esp32 stores the distribution network information +led displays the distribution network status + press the key to clear the distribution network information (source code attached)

2022年4月17日五心红娘团队收获双份喜报

Is the Ren domain name valuable? Is it worth investing? What is the application scope of Ren domain name?
随机推荐
ESP32存储配网信息+LED显示配网状态+按键清除配网信息(附源码)
Native method merge word
Is the Ren domain name valuable? Is it worth investing? What is the application scope of Ren domain name?
可升级合约的原理-DelegateCall
数字化转型挂帅复产复工,线上线下全融合重建商业逻辑
BEAUTIFUL GGPLOT VENN DIAGRAM WITH R
PX4 Position_Control RC_Remoter引入
Homer预测motif
Digital transformation takes the lead to resume production and work, and online and offline full integration rebuilds business logic
to_ Bytes and from_ Bytes simple example
Is it safe to open a stock account online? I'm a novice, please guide me
Data analysis - Matplotlib sample code
Cluster Analysis in R Simplified and Enhanced
Is the stock account given by qiniu business school safe? Can I open an account?
Principe du contrat évolutif - delegatecall
R HISTOGRAM EXAMPLE QUICK REFERENCE
Installation of ROS gazebo related packages
PgSQL string is converted to array and associated with other tables, which are displayed in the original order after matching and splicing
Esp32 audio frame esp-adf add key peripheral process code tracking
动态内存(进阶四)