hookehuyr

fix 键盘弹出框高度

......@@ -64,16 +64,27 @@ watch(
);
const openKeyboard = (e) => {
// // 键盘上移动
// const target_to_view_height = window.innerHeight - e.target.getBoundingClientRect().y; // 元素到适口高度
// const target_top = document.body.scrollHeight - $(e.target).offset().top; // 元素到正文高度
// let scroll_height = "";
// console.warn(target_top);
// if (target_top < 250) {
// document.getElementById("app").style.paddingBottom = "250px";
// window.scrollTo(0, $("#app").height());
// } else {
// // 向上滚动位置
// document.documentElement.scrollTop = (target_top > 250 ? 0 : target_top) + 250;
// }
// 键盘上移动
const target_to_view_height = window.innerHeight - e.target.getBoundingClientRect().y; // 元素到适口高度
const target_to_view_height =
window.innerHeight - e.target.getBoundingClientRect().bottom; // 元素到适口高度
const target_top = document.body.scrollHeight - $(e.target).offset().top; // 元素到正文高度
let scroll_height = "";
if (target_top < 244) {
document.getElementById("app").style.paddingBottom = "244px";
window.scrollTo(0, $("#app").height());
} else {
if (target_to_view_height <= 250) {
document.getElementById("app").style.paddingBottom = "250px";
// 向上滚动位置
document.documentElement.scrollTop = target_top + 244;
document.documentElement.scrollTop = $(e.target).offset().top - 244;
}
// 选中添加border颜色
content = $(e.target).parent();
......
......@@ -77,16 +77,21 @@ watch(
const showKeyboard = (e) => {
// 键盘上移动
// const target_to_view_height = window.innerHeight - e.target.getBoundingClientRect().y; // 元素到适口高度
const target_to_view_height =
window.innerHeight - e.target.getBoundingClientRect().bottom; // 元素到适口高度
const target_top = document.body.scrollHeight - $(e.target).offset().top; // 元素到正文高度
let scroll_height = "";
document.getElementById("app").style.paddingBottom = "244px";
if (target_top < 244) {
window.scrollTo(0, $("#app").height());
} else {
if (target_to_view_height <= 250) {
document.getElementById("app").style.paddingBottom = "250px";
// 向上滚动位置
document.documentElement.scrollTop = target_top + 244;
document.documentElement.scrollTop = $(e.target).offset().top - 244;
}
// if (target_top < 250) {
// window.scrollTo(0, $("#app").height());
// } else {
// // 向上滚动位置
// document.documentElement.scrollTop = (target_top > 500 ? 0 : target_top) + 250;
// }
// 选中添加border颜色
content = $(e.target).parent();
// TAG: 自定义主题颜色
......
......@@ -87,15 +87,14 @@ watch(
const openKeyboard = (e) => {
// 键盘上移动
const target_to_view_height = window.innerHeight - e.target.getBoundingClientRect().y; // 元素到适口高度
const target_to_view_height =
window.innerHeight - e.target.getBoundingClientRect().bottom; // 元素到适口高度
const target_top = document.body.scrollHeight - $(e.target).offset().top; // 元素到正文高度
let scroll_height = "";
if (target_top < 244) {
document.getElementById("app").style.paddingBottom = "244px";
window.scrollTo(0, $("#app").height());
} else {
if (target_to_view_height <= 250) {
document.getElementById("app").style.paddingBottom = "250px";
// 向上滚动位置
document.documentElement.scrollTop = target_top + 244;
document.documentElement.scrollTop = $(e.target).offset().top - 244;
}
// 选中添加border颜色
content = $(e.target).parent();
......