//监听苹果手机软键盘收起事件重置页面
document.body.addEventListener('focusin', () => { //软键盘弹起事件
console.info("[info] 软键盘已弹起...");
setTimeout(mihe_chat.scrollMsgBoxToBottom(), 10);
let scrollTop = 0;
if (document.documentElement && document.documentElement.scrollTop) {
scrollTop = document.documentElement.scrollTop;
} else if (document.body) {
scrollTop = document.body.scrollTop;
}
window.workrelateScrollTop = scrollTop;
});
let message_box = document.getElementById("message_box");
message_box.addEventListener('focusout', () => { //软键盘关闭事件
console.info("[info] 软键盘已关闭...");
let isIOS = /(ipod|iphone|ipad)/i.test(navigator.userAgent);
if (isIOS) { //使用定时器,执行时不影响主任务
setTimeout(function () {
document.body.scrollTop = window.workrelateScrollTop;
document.documentElement.scrollTop = window.workrelateScrollTop;
}, 100);
}
}, false);