diff --git a/index.html b/index.html index 6339369..425ce78 100644 --- a/index.html +++ b/index.html @@ -55,7 +55,7 @@
- +
diff --git a/javascape/chat.js b/javascape/chat.js index 352fee2..0a22938 100644 --- a/javascape/chat.js +++ b/javascape/chat.js @@ -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); } } \ No newline at end of file