
const originalHeight =
document.documentElement.clientHeight || document.body.clientHeight;
window.onresize = () => {
return (() => {
const resizeHeight =
document.documentElement.clientHeight || document.body.clientHeight;
console.log("进入到判断页面高度=========");
console.log("页面初始高度=========" + originalHeight);
console.log("软键盘弹起高度=========" + resizeHeight);
if (resizeHeight - 0 < originalHeight - 0) {
console.log("进入到软键盘弹起=========");
document
.querySelector("body")
.setAttribute("style", "height:" + originalHeight + "px;");
scrollerHeight.value = resizeHeight;
} else {
console.log("进入到软键盘收起=========");
document.querySelector("body").setAttribute("style", "height:100%;");
scrollerHeight.value = "100%";
}
})();
};