ios键盘弹出后,在收起的时候底部出现非页面的空白区
fixScroll() {
let u = navigator.userAgent;
let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
if (isiOS) {
window.scrollTo(0, 0);
}
}
安卓表单中的input框无法自动出现在可视区
upForm(time = 100) {
if (/iphone/i.test(navigator.userAgent)) {
// return
}
if (
document.activeElement.tagName === "INPUT" ||
document.activeElement.tagName === "TEXTAREA"
) {
setTimeout(() => {
document.activeElement.scrollIntoViewIfNeeded(true);
}, time);
}
}
安卓背景图会随着弹出软键盘上移
父级div--register,子元素div--content
.reigster {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100%;
min-height: calc(100% + 1px);
background: url("./../assets/login/back_login.png") no-repeat center;
background-size: cover;
}
.content {
position: relative;
height: 100vh;
overflow-y: auto;
width: 100%;
}
网友评论