zoukankan      html  css  js  c++  java
  • css3软键盘不盖住输入框的方法

    css3软键盘不盖住输入框的方法

    弹出软键盘的时候 最外面的容器高度就发生了变化 要减去软键盘高度了
    <pre>
    var bodyheight
    bodyheight = $('body').height();
    var bodywidth = $('body').width();
    $('.p6a input').on('click', function() {
    var inputwarptop = $(this).parents('.inputwarp').position().top;
    $('.p6a').css('height', bodyheight);
    $('.p6a').css('width', bodywidth);
    $('.p6a_bg').css('height', bodyheight);
    $('.p6a_bg').css('width', bodywidth);
    $('.swiper-container').css('height', bodyheight);
    $('.swiper-container').css('width', bodywidth);
    $('.swiper-container').css('top', '-' + (inputwarptop - 100) + 'px');
    $('.swiper-slide').css('height', bodyheight);
    $('.swiper-slide').css('width', bodywidth);
    //判断是否关闭键盘
    setTimeout(function() {
    var aa = setInterval(function() {
    var actbodyheight = $('body').height();
    if (bodyheight == actbodyheight) {
    $('.swiper-container').css('top', '0px');
    clearInterval(aa);
    }
    }, 200)
    }, 1000)
    })
    </pre>

  • 相关阅读:
    acm常见错误-持续更新
    学习之旅
    快速幂
    写个管理自我的小工具
    Tree构建
    Sql server学习
    asp.net webAPI学习
    AngularJS数据双向绑定
    虚拟机学习
    wps学习
  • 原文地址:https://www.cnblogs.com/newmiracle/p/11856455.html
Copyright © 2011-2022 走看看