移动端底部input被弹出的键盘遮挡

https://developer.mozilla.org/zh-CN/docs/Web/API/Element/scrollIntoView

 

移动端input被键盘遮挡,事件是跳到可视区域!

document.querySelector('#inputId').scrollIntoView();
//只要在input的点击事件,或者获取焦点的事件

 

还有一个事件是指定在上方或下方

https://developer.mozilla.org/zh-CN/docs/Web/API/Element/scrollIntoViewIfNeeded

 

posted @ 2018-05-20 10:49  Sunsin  阅读(1741)  评论(0编辑  收藏  举报