安卓机无法去掉,除非你自己写一个弹出的函数和页面出来
用原生的写,或者是框架。我用了vant框架的弹框解决了该问题。原生的写也不会出现这个问题的代码:
<!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-Type" content="text/html; charset=utf-8" />
<title>简易弹出框</title>
<style type="text/css">
html,
body,
.alertShow {
width: 100%;
height: 100%;
background-color: pink;
font-size: 36px;
}
.mydiv {
background-color: #fff;
text-align: center;
font-size: 36px;
z-index: 99;
width: 64%;
height: 15%;
left: 50%;
top: 50%;
position: fixed !important;
transform: translate(-50%, -50%);
border-radius: 20px;
}
.bg {
background-color: #ccc;
width: 100%;
height: 100%;
left: 0;
top: 0;
filter: alpha(opacity=10);
opacity: 0.8;
z-index: 1;
position: fixed !important;
position: absolute;
}
input[type="Submit"] {
font-size: 45px;
}
.tit_pop {
height: 160px;
line-height: 141px;
}
.btn_pop {
display: flex;
justify-content: space-around;
align-items: center;
height: 100px;
border-top: 1px solid #ccc;
}
</style>
<script type="text/javascript">
function showDiv() {
document.getElementById('popDiv').style.display = 'block';
document.getElementById('bg').style.display = 'block';
}
function cancel() {
document.getElementById('popDiv').style.display = 'none';
document.getElementById('bg').style.display = 'none';
}
function ensure() {
document.getElementById('popDiv').style.display = 'none';
document.getElementById('bg').style.display = 'none';
console.log(545);
}
</script>
</head>
<body>
<div class="alertShow">
<div id="popDiv" class="mydiv" style="display:none;">
<div class="tit_pop">弹框内容11111111</div>
<div class="btn_pop">
<div onclick="javascript:cancel()">取消</div>
<div onclick="javascript:ensure()">确定</div>
</div>
</div>
<div id="bg" class="bg" style="display:none;"></div>
<div>
<input type="Submit" name="" value="点此弹框" onclick="javascript:showDiv()" />
</div>
</div>
</body>
</html>