zl程序教程

您现在的位置是:首页 >  后端

当前栏目

css3软键盘不盖住输入框的方法详解编程语言

方法css3编程语言 详解 输入框 软键盘
2023-06-13 09:11:50 时间

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

弹出软键盘的时候 最外面的容器高度就发生了变化 要减去软键盘高度了


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)
})

原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/18892.html

cjava