移动安卓端,input输入获得焦点被键盘遮住简单解决方案
(function (window,document) {
document.querySelector('input[type="text"]').addEventListener('focus',function (e) {
setTimeout(function () {
var docHeight = window.innerHeight;
var bottom = e.target.getBoundingClientRect().bottom;
var scrollHeight = bottom-docHeight;
if (scrollHeight > 0) {
document.body.scrollTop = scrollHeight+document.body.scrollTop+10
}
}, 300)
}, false)
})(window,document)