-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
30 lines (25 loc) · 945 Bytes
/
script.js
File metadata and controls
30 lines (25 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const themeBtn = document.getElementById("themeToggle");
const langBtn = document.getElementById("langToggle");
const githubLogo = document.querySelector('img[alt="GitHub"]'); // GitHub 로고 선택
let isDark = false; // 처음은 라이트
let isKorean = true; // 처음은 한국어
/* 다크 / 라이트 */
themeBtn.addEventListener("click", () => {
document.body.classList.toggle("dark");
isDark = !isDark;
themeBtn.textContent = isDark ? "Light" : "Dark";
// 🔥 GitHub 로고 변경 추가
if (isDark) {
githubLogo.src = "images/github_v2.png"; // 다크모드용
} else {
githubLogo.src = "images/github.png"; // 라이트모드용
}
});
/* 언어 토글 */
langBtn.addEventListener("click", () => {
isKorean = !isKorean;
langBtn.textContent = isKorean ? "EN" : "KO";
document.querySelectorAll("[data-ko]").forEach(el => {
el.textContent = isKorean ? el.dataset.ko : el.dataset.en;
});
});