Showing
2 changed files
with
15 additions
and
8 deletions
@@ -23,12 +23,12 @@ const chatBox = $('#chat-window'); | @@ -23,12 +23,12 @@ const chatBox = $('#chat-window'); | ||
23 | 23 | ||
24 | 24 | ||
25 | // 聊天调整footer位置 | 25 | // 聊天调整footer位置 |
26 | -const resizeFooter = () => { | ||
27 | - let bottom = $('#chat-footer').height(); | 26 | +// const resizeFooter = () => { |
27 | +// let bottom = $('#chat-footer').height(); | ||
28 | 28 | ||
29 | - chatBox.css('bottom', `${bottom}px`); | ||
30 | - chatBox[0].scrollTop = chatBox[0].scrollHeight; | ||
31 | -}; | 29 | +// chatBox.css('bottom', `${bottom}px`); |
30 | +// chatBox[0].scrollTop = chatBox[0].scrollHeight; | ||
31 | +// }; | ||
32 | 32 | ||
33 | // 配置 | 33 | // 配置 |
34 | const msgTypeMap = { | 34 | const msgTypeMap = { |
@@ -168,7 +168,7 @@ var chat = { | @@ -168,7 +168,7 @@ var chat = { | ||
168 | }) | 168 | }) |
169 | .on('focus.chat.sendText', '.text-in', function() { | 169 | .on('focus.chat.sendText', '.text-in', function() { |
170 | $('.menu').hide(); | 170 | $('.menu').hide(); |
171 | - resizeFooter(); | 171 | + // resizeFooter(); |
172 | 172 | ||
173 | setTimeout(()=>{ | 173 | setTimeout(()=>{ |
174 | $('#chat-footer')[0].scrollIntoView(); | 174 | $('#chat-footer')[0].scrollIntoView(); |
@@ -176,7 +176,9 @@ var chat = { | @@ -176,7 +176,9 @@ var chat = { | ||
176 | }) | 176 | }) |
177 | .on('keydown.chat.sendText', '.text-in', function(event) { | 177 | .on('keydown.chat.sendText', '.text-in', function(event) { |
178 | event.stopPropagation(); | 178 | event.stopPropagation(); |
179 | - document.body.scrollTop = document.body.scrollHeight; | 179 | + setTimeout(()=>{ |
180 | + $('#chat-footer')[0].scrollIntoView(); | ||
181 | + }, 0); | ||
180 | 182 | ||
181 | if (event.which === 13) { | 183 | if (event.which === 13) { |
182 | let val = $.trim(event.target.value); | 184 | let val = $.trim(event.target.value); |
@@ -225,7 +227,7 @@ var chat = { | @@ -225,7 +227,7 @@ var chat = { | ||
225 | self.canEvalute = false; | 227 | self.canEvalute = false; |
226 | cmEntity.type = socketConf.recType.EVALUTE_SUCCESS; | 228 | cmEntity.type = socketConf.recType.EVALUTE_SUCCESS; |
227 | socket.send(JSON.stringify(cmEntity)); | 229 | socket.send(JSON.stringify(cmEntity)); |
228 | - resizeFooter(); | 230 | + // resizeFooter(); |
229 | }); | 231 | }); |
230 | 232 | ||
231 | window.addEventListener('online', function() { | 233 | window.addEventListener('online', function() { |
-
Please register or login to post a comment