Ajout d'un menu burger
This commit is contained in:
		@@ -4,94 +4,73 @@ body {
 | 
			
		||||
    font-family: 'Arial', sans-serif;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
header {
 | 
			
		||||
.navbar {
 | 
			
		||||
    background-color: #4A305A;
 | 
			
		||||
    color: #fff;
 | 
			
		||||
    padding: 15px 0;
 | 
			
		||||
    padding: 10px;
 | 
			
		||||
    display: flex;
 | 
			
		||||
    justify-content: space-between;
 | 
			
		||||
    align-items: center;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#logo {
 | 
			
		||||
    display: flex;
 | 
			
		||||
    align-items: center; /* Centrer verticalement le contenu du logo */
 | 
			
		||||
.logo img {
 | 
			
		||||
    width: 3cm;
 | 
			
		||||
    height: 1.5cm;
 | 
			
		||||
    margin-left: 2cm;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#logo img {
 | 
			
		||||
    max-width: 80px; /* Ajuste la taille du logo à 80 pixels (ou une valeur qui convient) */
 | 
			
		||||
    height: auto;
 | 
			
		||||
    margin-top: 5px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
nav {
 | 
			
		||||
.nav-links {
 | 
			
		||||
    display: flex;
 | 
			
		||||
    align-items: center;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
nav ul {
 | 
			
		||||
    list-style: none;
 | 
			
		||||
    display: flex;
 | 
			
		||||
    margin: 0;
 | 
			
		||||
    padding: 0;
 | 
			
		||||
    margin-left: auto; /* Pour déplacer vers la droite */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
nav ul li {
 | 
			
		||||
    margin-left: 20px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
nav a {
 | 
			
		||||
.nav-link {
 | 
			
		||||
    color: white;
 | 
			
		||||
    text-decoration: none;
 | 
			
		||||
    color: #fff;
 | 
			
		||||
    font-weight: bold;
 | 
			
		||||
    margin: 0 15px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#menu-icon {
 | 
			
		||||
.reserve-btn {
 | 
			
		||||
    background-color: #FFB039;
 | 
			
		||||
    padding: 10px 20px;
 | 
			
		||||
    border-radius: 10px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* ... (code précédent) */
 | 
			
		||||
 | 
			
		||||
.burger-menu {
 | 
			
		||||
    display: none;
 | 
			
		||||
    font-size: 24px;
 | 
			
		||||
    cursor: pointer;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#reserve-button {
 | 
			
		||||
    background-color: orange;
 | 
			
		||||
    color: #fff;
 | 
			
		||||
    padding: 10px 20px;
 | 
			
		||||
    border-radius: 10px;
 | 
			
		||||
    margin-left: 20px;
 | 
			
		||||
.burger-menu div {
 | 
			
		||||
    width: 25px;
 | 
			
		||||
    height: 3px;
 | 
			
		||||
    background-color: white;
 | 
			
		||||
    margin: 6px 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@media screen and (max-width: 768px) {
 | 
			
		||||
    nav {
 | 
			
		||||
        flex-direction: column;
 | 
			
		||||
        align-items: flex-start;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    nav ul {
 | 
			
		||||
    .nav-links {
 | 
			
		||||
        display: none;
 | 
			
		||||
        width: 100%;
 | 
			
		||||
        text-align: center;
 | 
			
		||||
        flex-direction: column;
 | 
			
		||||
        align-items: center;
 | 
			
		||||
        position: absolute;
 | 
			
		||||
        top: 60px;
 | 
			
		||||
        left: 0;
 | 
			
		||||
        background-color: #333;
 | 
			
		||||
        width: 100%;
 | 
			
		||||
        background-color: #4A305A;
 | 
			
		||||
        z-index: 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    nav ul.show {
 | 
			
		||||
    .nav-links.show {
 | 
			
		||||
        display: flex;
 | 
			
		||||
        flex-direction: column;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    nav ul li {
 | 
			
		||||
        margin: 0;
 | 
			
		||||
        margin-bottom: 10px;
 | 
			
		||||
    .nav-link {
 | 
			
		||||
        margin: 10px 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    #menu-icon {
 | 
			
		||||
    .burger-menu {
 | 
			
		||||
        display: block;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    #reserve-button {
 | 
			
		||||
        margin: 20px 0;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,40 +1,32 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="fr">
 | 
			
		||||
<html lang="en">
 | 
			
		||||
<head>
 | 
			
		||||
    <meta charset="UTF-8">
 | 
			
		||||
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | 
			
		||||
    <link rel="stylesheet" href="../css/styles.css">
 | 
			
		||||
    <title>Neo Eat - Acceuil</title>
 | 
			
		||||
    <title>Neo Eat</title>
 | 
			
		||||
</head>
 | 
			
		||||
<body>
 | 
			
		||||
 | 
			
		||||
<header>
 | 
			
		||||
    <div class="container">
 | 
			
		||||
        <div id="logo"><img src="../img/LogoNeoEat.png" alt="LogoNeoEat"></div>
 | 
			
		||||
        <nav>
 | 
			
		||||
            <ul>
 | 
			
		||||
                <li><a href="#">Accueil</a></li>
 | 
			
		||||
                <li><a href="#">Menu</a></li>
 | 
			
		||||
                <li><a href="#">À propos</a></li>
 | 
			
		||||
                <li><a href="#">Contact</a></li>
 | 
			
		||||
            </ul>
 | 
			
		||||
            <div id="menu-icon">☰</div>
 | 
			
		||||
            <a id="reserve-button" href="#">Réserver une table</a>
 | 
			
		||||
    <header class="navbar">
 | 
			
		||||
        <div class="logo">
 | 
			
		||||
            <img src="../img/LogoNeoEat.png" alt="Neo Eat Logo">
 | 
			
		||||
        </div>
 | 
			
		||||
        <nav class="nav-links">
 | 
			
		||||
            <a href="#" class="nav-link">Accueil</a>
 | 
			
		||||
            <a href="#" class="nav-link">Menu</a>
 | 
			
		||||
            <a href="#" class="nav-link">À propos</a>
 | 
			
		||||
            <a href="#" class="nav-link">Contact</a>
 | 
			
		||||
            <a href="#" class="nav-link reserve-btn">Réserver une table</a>
 | 
			
		||||
        </nav>
 | 
			
		||||
    </div>
 | 
			
		||||
</header>
 | 
			
		||||
        <div class="burger-menu">
 | 
			
		||||
            <div class="bar"></div>
 | 
			
		||||
            <div class="bar"></div>
 | 
			
		||||
            <div class="bar"></div>
 | 
			
		||||
        </div>
 | 
			
		||||
    </header>
 | 
			
		||||
 | 
			
		||||
<section id="hero">
 | 
			
		||||
    <div class="container">
 | 
			
		||||
        <h1>Bienvenue chez Neo Eat</h1>
 | 
			
		||||
        <p>Explorez l'avenir de la gastronomie avec notre restaurant 100% automatisé par des robots.</p>
 | 
			
		||||
        <a href="#menu">Voir le menu</a>
 | 
			
		||||
    </div>
 | 
			
		||||
</section>
 | 
			
		||||
 | 
			
		||||
<!-- Ajoutez d'autres sections pour présenter votre menu, l'équipe, etc. -->
 | 
			
		||||
 | 
			
		||||
<script src="../js/script.js"></script>
 | 
			
		||||
    <!-- Reste du contenu de votre site va ici -->
 | 
			
		||||
 | 
			
		||||
    <script src="../js/script.js"></script>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										15
									
								
								js/menu.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								js/menu.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
document.addEventListener("DOMContentLoaded", function () {
 | 
			
		||||
    const burgerMenu = document.querySelector('.burger-menu');
 | 
			
		||||
    const navLinks = document.querySelector('.nav-links');
 | 
			
		||||
 | 
			
		||||
    burgerMenu.addEventListener('click', function () {
 | 
			
		||||
        navLinks.classList.toggle('show');
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // Ajoutez le code suivant pour masquer le menu lorsque la largeur de l'écran est supérieure à 768px
 | 
			
		||||
    window.addEventListener('resize', function () {
 | 
			
		||||
        if (window.innerWidth > 768) {
 | 
			
		||||
            navLinks.classList.remove('show');
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
@@ -1,8 +1,8 @@
 | 
			
		||||
document.addEventListener('DOMContentLoaded', function () {
 | 
			
		||||
    const menuIcon = document.getElementById('menu-icon');
 | 
			
		||||
    const navList = document.querySelector('nav ul');
 | 
			
		||||
    const burgerMenu = document.querySelector('.burger-menu');
 | 
			
		||||
    const navLinks = document.querySelector('.nav-links');
 | 
			
		||||
 | 
			
		||||
    menuIcon.addEventListener('click', function () {
 | 
			
		||||
        navList.classList.toggle('show');
 | 
			
		||||
    burgerMenu.addEventListener('click', function () {
 | 
			
		||||
        navLinks.classList.toggle('show');
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
		Reference in New Issue
	
	Block a user