phoneX适配
来源:互联网 发布:mac google搜索打不开 编辑:程序博客网 时间:2024/06/07 02:48
var iphoneCompatibility = (function () {
return {
isIphoneX: function () {
if (window.devicePixelRatio && window.devicePixelRatio == 3 && document.documentElement.clientWidth == 375 && (navigator.userAgent.indexOf("Safari") > -1)) {
return true
} else {
return false
}
},
}
})();
var global_current_viewportHeight = window.innerHeight;
var global_bottom_bar_pannel;
var global_bottom_bar_activity_bar_img;
var global_back_to_top;
window.onscroll = function () {
if (iphoneCompatibility.isIphoneX()) {
global_back_to_top = document.querySelector("#mBack2Top");
global_bottom_bar_pannel = document.querySelector(".bottom-bar-pannel");
global_bottom_bar_activity_bar_img = document.querySelector(".bottom-bar-activity .bar-img");
if (window.innerHeight > global_current_viewportHeight) {
if (global_back_to_top) {
global_back_to_top.style.bottom = "82px"
}
global_bottom_bar_pannel.style.height = "70PX";
global_bottom_bar_activity_bar_img.style.bottom = "20PX"
} else {
if (global_back_to_top) {
global_back_to_top.style.bottom = "62px"
}
global_bottom_bar_pannel.style.transition = ".3s";
global_bottom_bar_pannel.style.height = "50PX";
global_bottom_bar_activity_bar_img.style.transition = ".3s";
global_bottom_bar_activity_bar_img.style.bottom = "0PX"
}
}
};
window.onresize = function () {
if (navigator.userAgent.indexOf("iPhone") > -1 && navigator.userAgent.indexOf("UCBrowser") > -1) {
var index_search_head = document.getElementById("index_search_head");
var index_newkeyword = document.getElementById("index_newkeyword");
if (index_search_head.classList.contains("on-focus")) {
window.scroll(0, 1)
} else {
index_search_head.style.marginTop = 0
}
}
};
return {
isIphoneX: function () {
if (window.devicePixelRatio && window.devicePixelRatio == 3 && document.documentElement.clientWidth == 375 && (navigator.userAgent.indexOf("Safari") > -1)) {
return true
} else {
return false
}
},
}
})();
var global_current_viewportHeight = window.innerHeight;
var global_bottom_bar_pannel;
var global_bottom_bar_activity_bar_img;
var global_back_to_top;
window.onscroll = function () {
if (iphoneCompatibility.isIphoneX()) {
global_back_to_top = document.querySelector("#mBack2Top");
global_bottom_bar_pannel = document.querySelector(".bottom-bar-pannel");
global_bottom_bar_activity_bar_img = document.querySelector(".bottom-bar-activity .bar-img");
if (window.innerHeight > global_current_viewportHeight) {
if (global_back_to_top) {
global_back_to_top.style.bottom = "82px"
}
global_bottom_bar_pannel.style.height = "70PX";
global_bottom_bar_activity_bar_img.style.bottom = "20PX"
} else {
if (global_back_to_top) {
global_back_to_top.style.bottom = "62px"
}
global_bottom_bar_pannel.style.transition = ".3s";
global_bottom_bar_pannel.style.height = "50PX";
global_bottom_bar_activity_bar_img.style.transition = ".3s";
global_bottom_bar_activity_bar_img.style.bottom = "0PX"
}
}
};
window.onresize = function () {
if (navigator.userAgent.indexOf("iPhone") > -1 && navigator.userAgent.indexOf("UCBrowser") > -1) {
var index_search_head = document.getElementById("index_search_head");
var index_newkeyword = document.getElementById("index_newkeyword");
if (index_search_head.classList.contains("on-focus")) {
window.scroll(0, 1)
} else {
index_search_head.style.marginTop = 0
}
}
};
阅读全文
0 0
- phoneX适配
- 适配
- 适配
- 适配
- 适配
- 适配
- 适配
- 适配
- 适配
- 适配
- 适配
- 适配
- 适配
- 适配
- 适配iphone
- 适配 ios6
- android适配
- UI 适配
- Lenet-5网络结构
- python正则表达式模块re中search和match方法的区别
- Java 调用Native Method 和Library
- 判断APP当前版本号与提供的apk对比是否需要升级
- kali Linux---tomcal服务启动,开启github无证书验证模式,开启shhd服务
- phoneX适配
- 国办公开办:30个省级政府初步建成网上政务服务平台
- Spark官方文档翻译思路与进度表
- easyUI的iframe子页面操作父页面元素
- 手机端rem布局详解(淘宝无限适配)
- stl迭代器失效
- loj6226「网络流 24 题」骑士共存问题(二分图最大点独立集,最小割)
- WinForm-SuspendLayout、ResumeLayout、PerformLayou——转载
- AS3:时间戳的转换