Skip to content

Commit

Permalink
Merge pull request #699 from Rohit72099/main
Browse files Browse the repository at this point in the history
Active Nav Links effect Done
  • Loading branch information
Tejashri-Taral authored Oct 29, 2024
2 parents 0772e6b + 6ba676e commit 563b337
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 4 deletions.
3 changes: 2 additions & 1 deletion about.html
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@

</li>
<li class="tab">
<a href="about.html">About</a>
<a href="about.html" class="active">About</a>
<div class="cursor"></div>
</li>
<li class="tab">
Expand Down Expand Up @@ -821,6 +821,7 @@ <h2>Subscription Successful!</h2>
})();
</script>
<script src="script/progressbar.js"></script>
<script src="active.js"></script>

</body>
</html>
11 changes: 11 additions & 0 deletions active.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
document.addEventListener("DOMContentLoaded", function() {
const tabs = document.querySelectorAll(".tab a");
const currentPage = window.location.pathname;

tabs.forEach(tab => {
// Check if the link matches the current page URL
if (tab.getAttribute("href") === currentPage.split('/').pop()) {
tab.classList.add("active");
}
});
});
3 changes: 2 additions & 1 deletion contact.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
</ul>
</li>
<li class="tab" style="margin-left: 15px;">
<a href="contact.html">Contact Us</a>
<a href="contact.html" class="active">Contact Us</a>
<div class="cursor"></div>
</li>
</ul>
Expand Down Expand Up @@ -281,6 +281,7 @@ <h1>Subscribe to Newsletter</h1>
</script>

<script src="script/progressbar.js"></script>
<script src="active.js"></script>

</body>

Expand Down
3 changes: 2 additions & 1 deletion features.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<div class="cursor"></div>
</li>
<li class="tab">
<a href="features.html">Features</a>
<a href="features.html" class="active">Features</a>
<div class="cursor"></div>
</li>
<li class="dropdown tab">
Expand Down Expand Up @@ -323,6 +323,7 @@ <h2>Subscription Successful!</h2>
})();
</script>
<script src="script/progressbar.js"></script>
<script src="active.js"></script>

</body>

Expand Down
4 changes: 3 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<div class="tabs-container">
<ul id="tabs" class="tabs">
<li class="tab">
<a href="index.html">Home</a>
<a href="index.html" class="active">Home</a>
<div class="cursor"></div>
</li>
<li class="tab">
Expand Down Expand Up @@ -847,6 +847,8 @@ <h2>Subscription Successful!</h2>
});
</script>
<script src="./script/popup.js"></script>
<script src="active.js"></script>


</body>

Expand Down
1 change: 1 addition & 0 deletions mens.html
Original file line number Diff line number Diff line change
Expand Up @@ -1314,5 +1314,6 @@ <h2>Subscription Successful!</h2>
<script src="script/progressbar.js"></script>



</body>
</html>
10 changes: 10 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,16 @@ html {
font-size: 20px;
}

/* navbar active ----------------*/
.tab a.active {
background-color: black;
color: white;
padding: 10px px; /* Add padding if needed */
border-radius: 30px; /* Add border-radius for rounded corners if desired */
}



.utils {
width: 8%;
height: 70px;
Expand Down

0 comments on commit 563b337

Please sign in to comment.