Toggle navigation
Toggle navigation
This project
Loading...
Sign in
최시원
/
Singer-Composer
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
devsho
2021-11-25 18:49:48 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9f6504f73669e758abf054e8db1cb261b8cefc73
9f6504f7
1 parent
2731778e
스크롤과 엔터키
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
7 deletions
js/chat.js
router/chat/chat.js
views/chat.ejs
js/chat.js
View file @
9f6504f
...
...
@@ -63,5 +63,17 @@ function send() {
// 서버로 message 이벤트 전달 + 데이터와 함께
socket
.
emit
(
'message'
,
{
type
:
'message'
,
message
:
message
})
}
function
a
(
chat
=
'chat'
){
var
element
=
document
.
getElementById
(
chat
);
element
.
scrollTop
=
element
.
scrollHeight
-
element
.
clientHeight
;
}
a
();
}
function
enterkey
()
{
if
(
window
.
event
.
keyCode
==
13
)
{
// 엔터키가 눌렸을 때 실행할 내용
send
();
}
}
\ No newline at end of file
...
...
router/chat/chat.js
View file @
9f6504f
...
...
@@ -39,10 +39,4 @@ router.get('/', function(req, res){
}
});
function
enterkey
()
{
if
(
window
.
event
.
keyCode
==
13
)
{
// 엔터키가 눌렸을 때 실행할 내용
send
();
}
}
module
.
exports
=
router
;
\ No newline at end of file
...
...
views/chat.ejs
View file @
9f6504f
...
...
@@ -29,7 +29,7 @@
<!-- 채팅 메시지 영역 -->
</div>
<div>
<input
type=
"text"
id=
"test"
placeholder=
"메시지를 입력해주세요.."
>
<input
onkeyup=
"enterkey()"
type=
"text"
id=
"test"
placeholder=
"메시지를 입력해주세요.."
>
<button
onclick=
"send()"
>
전송
</button>
</div>
</div>
...
...
Please
register
or
login
to post a comment