移动端输入框弹起影响布局(包括fixed布局情况)
使用 window.scrollIntoViewIfNeeded
window.addEventListener('resize',function(){
if(document.activeElement.tagName === "INPUT" || document.activeElement.tagName === "TEXTAREA"){
window.setTimeout(function(){
document.activeElement.scrollIntoViewIfNeeded();
},20)
}
})
监听resize,当是input或者textarea的时候,触发此函数
移动端还未测试,仅为备注作用。

浙公网安备 33010602011771号