๐Ÿ“ฆ zannager / Coding-a-website

๐Ÿ“„ menu.html ยท 41 lines
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
31
32
33
34
35
36
37
38
39
40
41<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Menu</title>
    <link rel="stylesheet" href="style.css">
    
</head>
<body>
    <header>
        <div class="logo-container">
            <a href="home.html"><img src="Images\logo.png" alt="DoBu Martial Arts Logo" class="logo"></a>
            <h1>DoBu Martial Arts</h1>
        
        <ul class="menu">
            <li class="menu-item"><a href="home.html">Home</a></li>
            <li class="menu-item"><a href="about.html">About Us</a></li>
            <li class="menu-item"><a href="schedule.html">Schedule</a></li>
            <li class="menu-item"><a href="pricing.html">Pricing</a></li>
            <li class="menu-item"><a href="contact.html">Contact Us</a></li>
        </ul>
        </div> 
    </header>

    <script>
        var currentUrl = window.location.href;

        var menuItems = document.querySelectorAll('.menu-item');
    
        menuItems.forEach(function(item) {
            var link = item.querySelector('a').getAttribute('href');
            if (currentUrl.endsWith(link)) {
                item.classList.add('active');
            }
        });
    </script>
  
</body>
</html>