End of the footer js part and little cleanup from the code

This commit is contained in:
2023-05-17 14:24:28 +02:00
parent 7c339a2df2
commit 0cd4cf3a2d
3 changed files with 8 additions and 11 deletions

View File

@@ -31,6 +31,7 @@ nav {
.menu li {
margin: 10px 0;
list-style: none;
background-color: #48435c;
}
.menu li a {
@@ -48,7 +49,3 @@ nav {
height: auto;
}
.menu li:hover{
background-color: #314153;
}

View File

@@ -66,7 +66,7 @@ document.getElementById("submitBtn").addEventListener("click", function() {
console.error("Ni pile, ni face !");
window.location.reload();
}
var random = Math.floor(Math.random() * 2);
let random = Math.floor(Math.random() * 2);
if (random === result) {
alert("Vous avez gagné ! Votre message a bien été envoyé !");
}

View File

@@ -47,17 +47,17 @@ document.addEventListener("click", function(event) {
//Récupérer les éléments du menu
const menuItems = document.querySelectorAll('.menu li');
const menuItemsElements = document.querySelectorAll('.menu li a');
menuItems.forEach((menuItem) => {
//Récupérer la couleur de fond originale
const originalBgColor = menuItem.style.backgroundColor;
console.log(originalBgColor)
menuItem.addEventListener('mouseover', () => {
//Récupérer la nouvelle couleur de fond
const newBgColor = menuItem.dataset.color;
let originalBgColor = getComputedStyle(menuItem).backgroundColor;
let newBgColor = "rgb(49, 65, 83)";
menuItem.style.backgroundColor = newBgColor;
console.log("L'ancienne couleur de fond était " + originalBgColor + " et la nouvelle est " + newBgColor + ".")
});
menuItem.addEventListener('mouseout', () => {
menuItem.style.backgroundColor = "";
});
});
//Lance les fonctions updateTime et startTimer