Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mithun522 committed Mar 25, 2024
1 parent f904d87 commit 03d9312
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions navigation-bar-01/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ <h3>Vector</h3>
</button>
</div>
</header>
<script src="script.js"></script>
</body>

</html>
10 changes: 10 additions & 0 deletions navigation-bar-01/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const navLinks = document.querySelectorAll('.navigation a');

navLinks.forEach(link => {
link.addEventListener('click', function(event) {
navLinks.forEach(link => {
link.classList.remove('active');
});
this.classList.add('active');
});
});
4 changes: 4 additions & 0 deletions navigation-bar-01/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ body {
background-color: var(--background);
}

.navigation li a.active {
color: var(--primary);
}

.navigation>li {
display: flex;
position: relative;
Expand Down

0 comments on commit 03d9312

Please sign in to comment.