首页 > Web开发 > 详细

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

时间:2019-11-14 13:58:49      阅读:115      评论:0      收藏:0      [点我收藏+]

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>

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!