公司网络代理的原因,导致碰到问题,只能百度.
以下都是百度出来,用到项目里,还未发现 bug 的整理
横,竖屏判断
window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", function() {
if (window.orientation === 180 || window.orientation === 0) {
console.log("竖屏")
}
if (window.orientation === 90 || window.orientation === -90){
console.log("横屏")
}
}, false);
安卓机,点击输入框,弹出键盘导致页面错位
function isA() {
var u = navigator.userAgent;
if (u.indexOf('Android')> -1 || u.indexOf('Linux') > -1) {
var windowHeight = document.documentElement.clientHeight;
document.body.style.height = windowHeight + 'px';
}
}
来源: http://www.qdfuns.com/notes/40663/2046e59263b9092d64ecb4744e036f5c.html