修复点击发送按钮会收回聊天框的问题
This commit is contained in:
1 parent
8cf6a23017
commit
d6e94bb591
2 files changed
+3
-2
No files matched your search
+2
-1
@@ -8,6 +8,7 @@ document.getElementById('userInput').addEventListener('keydown', function(event)
|
||||
// 控制聊天框显示和隐藏
|
||||
const chatBox = document.getElementById('chatContainer');
|
||||
const inputBox = document.getElementById('userInput');
|
||||
const sendBox = document.getElementById('sendbutton');
|
||||
|
||||
// 点击输入框时打开聊天框
|
||||
function openChat(e) {
|
||||
@@ -49,7 +50,7 @@ function toggleChat(show) {
|
||||
|
||||
function outsideClickListener(event) {
|
||||
// 点击目标既不在聊天框也不在输入框里,就收起
|
||||
if (!chatBox.contains(event.target) && !inputBox.contains(event.target)) {
|
||||
if (!chatBox.contains(event.target) && !inputBox.contains(event.target) && !sendBox.contains(event.target)) {
|
||||
toggleChat(false);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user