手机弹出键盘 窗口改变事件

var winHeight = $(window).height();
$(window).resize(function () {
var thisHeight = $(this).height();
if (winHeight - thisHeight > 50) {
setTimeout(function () { window.scrollTo(0, document.body.scrollHeight); }, 300)  // 滚动条加载到底部;
} else {
//窗口发生改变(小),故此时键盘收起
//当软键盘收起,在此处操作
}
});

posted @ 2018-03-10 13:59  模糊的星空  阅读(407)  评论(0编辑  收藏  举报