好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

分享HTML5虚拟键盘出现挡住输入框的解决办法

本文主要分享HTML5虚拟键盘出现挡住输入框的解决办法。具有很好的参考价值,下面跟着小编一起来看下吧

 //防止键盘把当前输入框给挡住
$$('input[type="text"],textarea').on('click', function () {
  var target = this;
  setTimeout(function(){
        target.scrollIntoViewIfNeeded();
   },100);
}); 
 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);
        }
    })
} 

以上就是分享HTML5虚拟键盘出现挡住输入框的解决办法的详细内容,更多请关注Gxl网其它相关文章!

查看更多关于分享HTML5虚拟键盘出现挡住输入框的解决办法的详细内容...

  阅读:39次