js微信跳转提示
微站长
3年前
1325
0
用法:微信打开链接提示要跳转才能访问,用处嘛自己想~
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>跳转提示</title>
<style type="text/css">
*{margin:0; padding:0;}
a{text-decoration: none;}
img{max-width: 100%; height: auto;}
.weixin-tip{display: none; position: fixed; left:0; top:0; bottom:0; background: rgba(0,0,0,0.8); filter:alpha(opacity=80); height: 100%; width: 100%; z-index: 100;}
.weixin-tip p{text-align: center; margin-top: 10%; padding:0 5%;}
.tiaozhuan {
font-size: 16px;
font-weight: 300;
color: #fff;
text-align: center;
}
.putong {
display: none;
width: 200px;
margin: 0 auto;
text-align: center;
margin-top: 50px;
font-size: 20px;
}
</style>
</head>
<body>
<div>
<p>
<img src="live_weixin.png" alt="微信打开"/>
<div>
微信又不让访问了,整个人都不好了
</div>
</p>
</div>
<div></div>
</body>
<script src="//libs.baidu.com/jquery/1.9.0/jquery.js"></script>
<!--如果是微信访问-->
<script type="text/javascript">
function isWeiXin(){
var ua = navigator.userAgent.toLowerCase();
if(ua.match(/MicroMessenger/i)=="micromessenger") {
return true;
} else {
return false;
}
}
if(isWeiXin()) {
$(window).on("load",function(){
var winHeight = $(window).height();
$(".weixin-tip").css("height",winHeight);
$(".weixin-tip").show();
})
}else {
let div = $('.putong');
div.show();
let time = 3;
setInterval(function() {
if(time == 0) {
// location.href = 'https://www.vzzw.com';
}else {
div.html('将在' + time + '秒后跳转···');
time--;
}
},1000)
}
</script>
</html>THE END
评论列表