移动页面写定位时不用fixed定位
const brand = navigator.userAgent.indexOf(‘Android’)
if (brand > -1) {
const maxHeight = document.body.clientHeight
window.addEventListener(‘resize’, function () {
const presentHeight = document.body.clientHeight
if (document.activeElement.tagName === ‘INPUT’ || document.activeElement.tagName === ‘TEXTAREA’) {
if (presentHeight < maxHeight) {
// 隐藏底部导航
document.getElementById(‘footer’).style.display = ‘none’
window.setTimeout(function () {
document.activeElement.scrollIntoViewIfNeeded()
document.scrollIntoView(true)
}, 100)
} else {
document.getElementById(‘footer’).style.display = ‘flex’
}
}
})
}
移动web页面,input获取焦点弹出系统虚拟键盘时,挡住input的解决方案
最新推荐文章于 2024-03-21 17:16:57 发布