代码描述:JavaScript 输入框软键盘 遮挡问题 解决方案。JavaScript输入框软键盘遮挡问题解决方案
这个可能很多做移动端开发的都遇到过,尤其是安卓系统。 弹出的软键盘遮挡了输入框,下面就是一个能够解决此问题的代码片段。
<script> var windowHeight = document.documentElement.clientHeight; $('input').bind("focus", function () { document.body.style.height = windowHeight + 'px'; setTimeout(function () { document.body.scrollTop = 120; document.documentElement.scrollTop = 120; window.pageYOffset = 120; }, 100) }); </script>
请绑定手机号,在继续操作
注意:只有绑定手机以后,才可使用网站全部功能