$(function(){
//判断是web应用还是浏览器
var browser={
versions:function(){
var u = navigator.userAgent, app = navigator.appVersion;
return {//移动终端浏览器版本信息
trident: u.indexOf('Trident') > -1, //IE内核
presto: u.indexOf('Presto') > -1, //opera内核
webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核
mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器
iPhone: u.indexOf('iPhone') > -1 , //是否为iPhone或者QQHD浏览器
iPad: u.indexOf('iPad') > -1, //是否iPad
webApp: u.indexOf('Safari') == -1, //是否web应该程序,没有头部与底部
weixin: u.indexOf('MicroMessenger') > -1, //是否微信
qq: u.match(/\sQQ/i) == " qq" //是否QQ
};
}(),
language:(navigator.browserLanguage || navigator.language).toLowerCase()
}
if(browser.versions.webApp){
$(".y_sharey").show();
//iphone底部按钮样式
if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
//alert($(document.body).width());
//alert($(document.body).height());
//苹果屏幕宽等于320或者小于320
if($(document.body).width()=== 320 ||$(document.body).width() < 320){
$(".y_btnfixed").find(".btn_fixed").css({"bottom":"0"}).removeAttr("id");
}else if($(window).width() === 375 && $(window).height() === 832){
$('.finend-link').css({"margin-top":"1.6rem"});
}else{
// $('header .y_set img').css({"padding-top":"10px"});
$(".y_btnfixed").find(".btn_fixed").css({"bottom":"1.8rem"}).removeAttr("id");
$(".y_btnfixed").find(".btn_fixed").css({"bottom":"1.8rem"}).removeAttr("id");
$(".y_btnfixed2").find(".btn_fixed").css({"bottom":"1.8rem"}).removeAttr("id");
$("#hospitalGuahao").find(".btn_fixed").css({"bottom":"0"});
}
} else if (/(Android)/i.test(navigator.userAgent)) {
$(".y_btnfixed").find(".btn_fixed").css({"bottom":"0"}).removeAttr("id");
}
}else{
$(".y_sharey").hide();
//浏览器删除id
$(".y_btnfixed").find(".btn_fixed").removeAttr("id");
//品类管理当浏览器时改变bottom
$('.btniFxed').css({"bottom":"2.4rem"});
if($(window).width() === 375 && $(window).height() === 812){
$('.finend-link').css({"margin-top":"1.6rem"});
}else{
$('.finend-link').css({"margin-top":"0"});
}
}
})
判断访问终端
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 判断浏览器类型 js用来区别IE与其他浏览器及IE6-8之间的方法。 1、document.all2、!!wind...
- 最近在开发项目的时候,分别开发了PC端和手机端,需要实现,用手机访问PC端WWW域名的时候,自动判断跳转到移动端,...