chohj06ms commited on
Commit
adb5801
โ€ข
1 Parent(s): ea8b029

Update script.js

Browse files
Files changed (1) hide show
  1. script.js +5 -6
script.js CHANGED
@@ -23,21 +23,20 @@ document.addEventListener('DOMContentLoaded', () => {
23
 
24
  // ํ‚ค๋ณด๋“œ ์ด๋ฒคํŠธ
25
  document.addEventListener('keydown', (e) => {
26
- if (e.key === 'ArrowLeft') {
27
- //๊ฐ€์žฅ ์™ผ์ชฝ์— ์œ„์น˜ํ•˜๋ฉด ๋งˆ์ด๋„ˆ์Šค ๋˜๋Š”๊ฑธ ๋ง‰๊ธฐ์œ„ํ•œ if๋ฌธ
28
  if (currentIndex > 0) {
29
- //ํ˜„์žฌ ์œ„์น˜ ๋นผ๊ธฐ 1
30
  moveToSlide(currentIndex - 1);
31
  }
32
- } else if (e.key === 'ArrowRight') {
33
- //๊ฐ€์žฅ ์˜ค๋ฅธ์ชฝ์— ์œ„์น˜ํ•˜๋ฉด ํ”Œ๋Ÿฌ์Šค ๋˜๋Š”๊ฑธ ๋ง‰๊ธฐ์œ„ํ•œ if๋ฌธ
34
  if (currentIndex < totalSlides - 1) {
35
- //ํ˜„์žฌ ์œ„์น˜ ๋”ํ•˜๊ธฐ 1
36
  moveToSlide(currentIndex + 1);
37
  }
38
  }
39
  });
40
 
 
41
  // ํ„ฐ์น˜ ์ด๋ฒคํŠธ ์‹œ์ž‘
42
  slider.addEventListener('touchstart', (e) => {
43
  startTouchPosition = e.touches[0].clientX;
 
23
 
24
  // ํ‚ค๋ณด๋“œ ์ด๋ฒคํŠธ
25
  document.addEventListener('keydown', (e) => {
26
+ if (e.key === 'ArrowLeft' || e.key === 'a') {
27
+ // 'ArrowLeft', 'a', 'ใ…' ํ‚ค ์ฒ˜๋ฆฌ
28
  if (currentIndex > 0) {
 
29
  moveToSlide(currentIndex - 1);
30
  }
31
+ } else if (e.key === 'ArrowRight' || e.key === 'd') {
32
+ // 'ArrowRight', 'd' ํ‚ค ์ฒ˜๋ฆฌ
33
  if (currentIndex < totalSlides - 1) {
 
34
  moveToSlide(currentIndex + 1);
35
  }
36
  }
37
  });
38
 
39
+
40
  // ํ„ฐ์น˜ ์ด๋ฒคํŠธ ์‹œ์ž‘
41
  slider.addEventListener('touchstart', (e) => {
42
  startTouchPosition = e.touches[0].clientX;