移动端文本框会被挡住处理

var h = $(window).height(),
mcss = $(".banner2-con").css("margin");
window.onresize=function(){
if( $(document.activeElement).hasClass("banner2-year")) {
if($(window).height()<h){
$(".banner2-con").css("margin","0 auto 3.2rem");
}else{
$(".banner2-con").css("margin",mcss);
}
}else if($(window).height() == h){
$(".banner2-con").css("margin",mcss);
}
}; 
//year输入框回车事件,fix andorid keyboard next button bug
$('#txtyear').keydown(function(e) { 
//tab or enter event
if (e.keyCode == 9 || e.keyCode == 13) { 
e.preventDefault();
$('#btnConfirm').click();
$(this).blur();
} 
});

 

posted @ 2018-01-05 16:35  糖糖部落  阅读(349)  评论(0)    收藏  举报