<div class="is-iosshow"><img src="../addons/ewei_shopv2/template/mobile/default/static/images/png2.png"> </div>
<div class="is-show"> <img src="../addons/ewei_shopv2/template/mobile/default/static/images/png1.png"> </div>
<style>
.is-show{
position: fixed;
position:absolute;
right:0;
left: 0;
top: 0;
bottom: 0;
z-index: 999;
background-color: rgba(0, 0, 0, 0.9);
}
.is-show img{
width: 100%;
}
.is-iosshow{
position: fixed;
position:absolute;
right:0;
left: 0;
top: 0;
bottom: 0;
z-index: 999;
background-color: rgba(0, 0, 0, 0.9);
}
.is-iosshow img{
width: 100%;
}
</style>
<script>
//判断是否微信登陆
function isWeiXin() {
var ua = window.navigator.userAgent.toLowerCase();
console.log(ua);//mozilla/5.0 (iphone; cpu iphone os 9_1 like mac os x) applewebkit/601.1.46 (khtml, like gecko)version/9.0 mobile/13b143 safari/601.1
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
return true;
} else {
return false;
}
}
if(isWeiXin()){
//alert(" 是来自微信内置浏览器")
var u = navigator.userAgent;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
if(isiOS){
//alert('是苹果');
$(".is-iosshow").show();
$(".is-show").hide();
}else{
//alert('是安卓');
$(".is-iosshow").hide();
$(".is-show").show();
}
}else{
//alert("不是来自微信内置浏览器")
$(".is-iosshow").hide();
$(".is-show").hide();
}
</script>
Last modification:April 30th, 2019 at 09:37 am
© The copyright belongs to the author