首页 > Web开发 > 详细

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

时间:2017-02-10 13:10:09      阅读:267      评论:0      收藏:0      [点我收藏+]

//防止键盘把当前输入框给挡住
$$(‘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 虚拟键盘出现挡住输入框的解决办法

原文:http://www.cnblogs.com/pfyblog/p/6385674.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!