$("input,textarea").focus(function() {
var keyboardHeight = localHeight - $("section").height();//获取键盘的高度
var keyboardY = localHeight - keyboardHeight;
var addBottom = (parseInt($(this).position().top) + parseInt($(this).height()));//文本域的底部
var offset = addBottom - keyboardY;//计算上滑的距离
$("section").scrollTop(offset);
});```
网友评论