手机软键盘挡住了输入框解决方法

$("input").focus(function () {
var num = $(this).offset().top;
$("html,body").animate({scrollTop: num}, 800);

}); //关键代码



      $("input").focus(function () {
            var num = $(this).offset().top;
            setTimeout(function () {
                $("body,html").scrollTop(num);
            }, 200);

        });  //关键代码

 

posted @ 2017-02-28 17:09  sunniejs  阅读(783)  评论(0编辑  收藏  举报