Skip to content

Commit 3f5d722

Browse files
committed
Langues toggle + CSS/JS
1 parent c1c1b42 commit 3f5d722

2 files changed

Lines changed: 46 additions & 1 deletion

File tree

assets/css/style.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,3 +664,18 @@ footer {
664664
opacity: 0;
665665
}
666666
}
667+
668+
.language-btn {
669+
opacity: 0.7;
670+
transition: opacity 0.3s;
671+
}
672+
.language-btn.active {
673+
opacity: 1;
674+
font-weight: bold;
675+
}
676+
.lang-content {
677+
display: none;
678+
}
679+
.lang-content.active {
680+
display: block;
681+
}

assets/js/main.js

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,34 @@ newOrderSound.on('stop', () => setStatus('play-btn-blue-monday', false));
8888

8989
winxSound.on('play', () => setStatus('play-btn-winx', true));
9090
winxSound.on('pause', () => setStatus('play-btn-winx', false));
91-
winxSound.on('stop', () => setStatus('play-btn-winx', false));
91+
winxSound.on('stop', () => setStatus('play-btn-winx', false));
92+
93+
document.addEventListener('DOMContentLoaded', () => {
94+
const btns = document.querySelectorAll('.language-btn');
95+
const contents = document.querySelectorAll('.lang-content');
96+
97+
// Par défaut, cache tout sauf Français
98+
contents.forEach((c, i) => {
99+
if (i === 0) c.classList.add('active');
100+
else c.style.display = 'none';
101+
});
102+
btns[0].classList.add('active');
103+
104+
btns.forEach(btn => {
105+
btn.addEventListener('click', () => {
106+
const lang = btn.dataset.lang;
107+
108+
// Toggle active
109+
btn.classList.toggle('active');
110+
111+
// Montre/cacher contenu
112+
contents.forEach(c => {
113+
if (c.dataset.lang === lang) {
114+
c.style.display = c.style.display === 'none' ? 'block' : 'none';
115+
} else {
116+
c.style.display = 'none';
117+
}
118+
});
119+
});
120+
});
121+
});

0 commit comments

Comments
 (0)