HTML5 虚拟键盘出现挡住输入框可以用代码
发布时间:2018/1/3 10:33:08 来源: 纵横数据
1 2 3 4 5 6 7 | //防止键盘把当前输入框给挡住 $$( 'input[type="text"],textarea' ).on( 'click' , function () { var target = this ; setTimeout( function (){ target.scrollIntoViewIfNeeded(); },100); }); |
部分安卓机型适用。
1 2 3 4 5 6 7 8 9 | if (/Android [4-6]/.test(navigator.appVersion)) { window.addEventListener( "resize" , function () { if (document.activeElement.tagName== "INPUT" || document.activeElement.tagName== "TEXTAREA" ) { window.setTimeout( function () { document.activeElement.scrollIntoViewIfNeeded(); },0); } }) } |
本文来源:
https://www.zndata.com/article/1923.html
[复制链接]
链接已复制
上一篇:没有了
下一篇:没有了