zoukankan      html  css  js  c++  java
  • 手机端上点击input框软键盘出现时把input框不被覆盖,显示在屏幕中间

     1  
    用定位为题来解决
    var oHeight = $(document).height(); //浏览器当前的高度
       
       $(window).resize(function(){

            if($(document).height() < oHeight){
             
            $("#footer").css("position","static");
        }else{
             
            $("#footer").css("position","absolute");
        }
            
       });

    2 第二种方法是改变可是区域的高度
    var loaclHeight = $("section").height();//获取可视宽度
    $("input,textarea").focus(function() {
    var keyboardHeight = localHeight - $("section").height();//获取键盘的高度
    var keyboardY = localHeight - keyboardHeight;
    var addBottom = (parseInt($(this).position().top) + parseInt($(this).height()));//文本域的底部
    var offset = addBottom - keyboardY;//计算上滑的距离
    $("section").scrollTop(offset);
    }); 
  • 相关阅读:
    Sony Z1 USB 调试
    消除“Unfortunately, System UI has stopped”的方法
    变动数据模拟cons
    string to integer
    single number
    罗马数字转为阿拉伯数字
    整数逆序
    回文数字
    回文字符串
    count and say
  • 原文地址:https://www.cnblogs.com/xzzzys/p/7526761.html
Copyright © 2011-2022 走看看