键盘弹起后 body 会增加 class="openkey"
用 openkey 调整表单的高度,让其在上半屏显示完整的表单,避免被遮挡
$(function(){
w = $(window).height();
ht = $('body').scrollTop();
$(window).resize(function(){
inps(3);
})
$('input').focus(function(){
inps(1);
})
$('input').blur(function(){
inps(0);
})
function inps(x){
if(x==3){
w2 = $(window).height();
if(w2
x = 1;
}
else
{
x = 0;
}
}
if(x==0){
$('body').removeClass('openkey');
}
if(x==1){
$('body').addClass('openkey');
}
}
})