js处理安卓软键盘遮住input的问题

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/love_fish_dream/article/details/80090684
  var winHeight = $(window).height(); //获取当前页面高度  
          $(window).resize(function() {  
              var thisHeight = $(this).height();  
              if (winHeight - thisHeight > 50) {  
                  //当软键盘弹出,在这里面操作  
                  //alert('aaa');  
                  $('body').css('height', winHeight + 'px');  
              } else {  
                  //alert('bbb');  
                  //当软键盘收起,在此处操作  
                  $('body').css('height', '100%');  
              }  
          });  

猜你喜欢

转载自blog.csdn.net/love_fish_dream/article/details/80090684