移动端,input输入获得焦点被键盘遮住简单解决方案
2018-02-02 16:26
309 查看
(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 } },400) },false) })(window,document)
//可以解决部分代码的
http://www.cnblogs.com/jiebba/p/8405772.html 更好的解决方案在这里
相关文章推荐
- #308 – 获得当前拥有键盘输入焦点的控件(Checking to See Which Control Has Keyboard Focus)
- iOS下Html页面中input获取焦点弹出键盘时挡住input解决方案—scrollIntoView()
- javascript——移动端input,textarea输入框获得焦点页面上移
- esasyui 和 KindEditor 在同一页面,input无法获得焦点,无法输入
- 移动端解决fixed和input获取焦点软键盘弹出影响定位的问题
- 移动端fixed和input获取焦点软键盘弹出影响定位的问题
- html在移动端input调出数字键盘同时密文输入
- EditText无法输入内容,无法获得焦点,无法自动弹出键盘
- iOS下Html页面中input获取焦点弹出键盘时挡住input解决方案—scrollIntoView()
- iOS下Html页面中input获取焦点弹出键盘时挡住input解决方案
- 实现input移动端自动获取焦点以及数字键盘搜索功能
- input(输入框)根据id获得焦点(focus)事件无效解决方案
- 使用 HTML5 input 类型提升移动端输入体验(键盘)
- 使用 HTML5 input 类型提升移动端输入体验(键盘)
- iOS下Html页面中input获取焦点弹出键盘时挡住input解决方案
- 使用 HTML5 input 类型提升移动端输入体验(键盘)
- 移动端解决fixed和input获取焦点软键盘弹出影响定位的问题
- 移动端解决fixed和input获取焦点软键盘弹出影响定位的问题
- 当input获取倒焦点的时候,获得输入内容
- java获得键盘输入的两种方法