This commit is contained in:
sermandm 2025-03-23 14:56:01 +01:00
parent cb3ea0a734
commit 42d16bce7d
4 changed files with 1 additions and 94 deletions

View File

@ -8,34 +8,4 @@ document.addEventListener("DOMContentLoaded", () => {
const isExpanded = navbar.classList.contains("active");
menuToggle.setAttribute("aria-expanded", isExpanded.toString());
});
// Thème clair/sombre
const toggleButton = document.getElementById('theme-toggle');
const body = document.body;
const transitionScreen = document.getElementById('theme-transition');
// Appliquer le thème sauvegardé
const savedTheme = localStorage.getItem('theme');
if (savedTheme === 'dark') {
body.classList.add('dark-theme');
toggleButton.textContent = '☀️';
}
toggleButton.addEventListener('click', () => {
// Ajoute le fondu
transitionScreen.classList.add('active');
setTimeout(() => {
// Toggle le thème
body.classList.toggle('dark-theme');
const isDark = body.classList.contains('dark-theme');
toggleButton.textContent = isDark ? '☀️' : '🌙';
localStorage.setItem('theme', isDark ? 'dark' : 'light');
// Retire le fondu après transition
setTimeout(() => {
transitionScreen.classList.remove('active');
}, 400);
}, 100);
});
});

View File

@ -15,7 +15,6 @@ body {
flex-direction: column;
min-height: 100vh;
overflow-x: hidden;
transition: background-color 0.3s, color 0.3s;
}
/* Header */
@ -92,16 +91,6 @@ footer {
margin-top: auto;
}
/* Bouton toggle thème */
#theme-toggle {
background: none;
border: none;
color: #fff;
font-size: 1.5rem;
cursor: pointer;
margin-left: 1rem;
}
/* Responsive */
@media (max-width: 980px) {
#menu-toggle {
@ -133,54 +122,3 @@ footer {
text-align: right;
}
}
/* 🌙 Thème sombre */
body.dark-theme {
background-color: #1e1e1e;
color: #e0e0e0;
}
body.dark-theme header,
body.dark-theme footer {
background-color: #121212;
color: #f1f1f1;
}
body.dark-theme #navbar a {
color: #ccc;
}
body.dark-theme #navbar a:hover {
color: #1abc9c;
}
body.dark-theme #navbar ul li a.active {
border-bottom: 2px solid #1abc9c;
}
body.dark-theme #navbar {
background-color: #222;
}
body.dark-theme #theme-toggle {
color: #f1f1f1;
}
/* Couvre-écran de transition de thème */
#theme-transition {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #1abc9c;
pointer-events: none;
opacity: 0;
z-index: 9999;
transition: opacity 0.4s ease;
}
#theme-transition.active {
opacity: 1;
}

View File

@ -15,4 +15,4 @@
</footer>
<script src="http://localhost/portfolio/public/asset/script/script.js"></script>
</body>
</html>
</html>

View File

@ -18,5 +18,4 @@
<h1>Bienvenue sur mon portfolio</h1>
<p>Voici la page d'accueil de l'application.</p>
<div id="theme-transition"></div>
</main>