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>

原文地址:https://www.cnblogs.com/newmiracle/p/11856455.html