Skip to content

Commit

Permalink
修复部分情况下的排版错误问题
Browse files Browse the repository at this point in the history
  • Loading branch information
YubaC committed Dec 2, 2022
1 parent ad448ae commit 17c62bf
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 23 deletions.
28 changes: 11 additions & 17 deletions litewebchatinput.css
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
/* 全局 */

html,
body {
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}


/* 聊天区域 */

.lite-chatbox {
height: calc(100vh - 150px);
height: calc(100% - 150px);
}

.lite-chatbox :last-child {
Expand All @@ -25,7 +14,7 @@ body {
.lite-chatinput {
width: 100%;
height: 150px;
position: fixed;
position: relative;
bottom: 0px;
background-color: #fff;
}
Expand All @@ -36,9 +25,10 @@ body {
.lite-chatinput hr {
cursor: s-resize;
margin: 0 auto;
border: 0;
height: 3px;
background: rgba(0, 0, 0, 0.2);
border-width: 1px 0px 0px 0px;
border-color: rgba(0, 0, 0, 0.2);
height: 5px;
background: #fff;
}


Expand All @@ -59,7 +49,7 @@ body {
/* 发送按钮 */

.lite-chatinput .send {
position: fixed;
position: absolute;
bottom: 12px;
right: 40px;
padding: 4px 20px 4px 20px;
Expand All @@ -70,6 +60,10 @@ body {
-webkit-box-shadow: 5px 5px 15px 0 rgba(102, 102, 102, 0.1);
box-shadow: 5px 5px 15px 0 rgba(102, 102, 102, 0.1);
border: none;
border-radius: 6px;
/* 老的 Firefox */
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
}

.lite-chatinput .send:hover {
Expand Down
18 changes: 14 additions & 4 deletions litewebchatinput.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ oLine.onmousedown = function(ev) {
var diff = iEvent.clientY - dy; //移动的距离(向上滑时为负数,下滑时为正数)
if (100 < (upperHeight + diff) && 100 < (downHeight - diff)) {
//两个div的最小高度均为100px
upperChild.style.height = (upperHeight + diff) + 'px';
upperChild.style.height = `calc(100% - ${downHeight - diff}px)`;
downChild.style.height = (downHeight - diff) + 'px';
}
};
Expand All @@ -75,16 +75,26 @@ emojiBtn.onclick = function() {

// 全屏编辑文字
editFullScreen.onclick = function() {
nowHeight = downChild.clientHeight;
downChild.style.height = "100%";
downHeight = downChild.clientHeight;
upperHeight = upperChild.clientHeight;
downChild.style.height = `100%`;
upperChild.style.height = "0px";
editFullScreen.style.display = "none";
exitFullScreen.style.display = "block";
oLine.style.display = "none";
}

// 退出全屏编辑文字
exitFullScreen.onclick = function() {
downChild.style.height = `${nowHeight}px`;
// 防呆不防傻,用于避免上部聊天窗口被压到没有高度后出现异常
if (upperHeight != 0) {
downChild.style.height = `${downHeight}px`;
upperChild.style.height = `calc(100% - ${downHeight}px)`;
} else {
upperChild.style.height = "calc(100% - 150px)";
downChild.style.height = "150px";
}

exitFullScreen.style.display = "none";
editFullScreen.style.display = "block";
oLine.style.display = "block";
Expand Down
2 changes: 1 addition & 1 deletion litewebchatinput.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion litewebchatinput.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 17c62bf

Please sign in to comment.