Skip to content

Commit ee6cd8f

Browse files
committed
Refactor : Add functionality for nav bar
1 parent 07e3eea commit ee6cd8f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

index.html

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<body>
1010
<nav>
1111
<ul class="sidebar">
12-
<li><a href="#"><svg xmlns="http://www.w3.org/2000/svg" height="26" viewBox="0 96 960 960" width="26"><path d="m249 849-42-42 231-231-231-231 42-42 231 231 231-231 42 42-231 231 231 231-42 42-231-231-231 231Z"/></svg></a></li>
12+
<li><a href="#" onclick=hideSidebar()><svg xmlns="http://www.w3.org/2000/svg" height="26" viewBox="0 96 960 960" width="26"><path d="m249 849-42-42 231-231-231-231 42-42 231 231 231-231 42 42-231 231 231 231-42 42-231-231-231 231Z"/></svg></a></li>
1313
<li><a href="#">Blog</a></li>
1414
<li><a href="#">Products</a></li>
1515
<li><a href="#">About</a></li>
@@ -23,11 +23,18 @@
2323
<li class="hideOnMobile"><a href="#">About</a></li>
2424
<li class="hideOnMobile"><a href="#">Forum</a></li>
2525
<li class="hideOnMobile"><a href="#">Login</a></li>
26-
<li class="menu-button"><a href="#"><svg xmlns="http://www.w3.org/2000/svg" height="26" viewBox="0 96 960 960" width="26"><path d="M120 816v-60h720v60H120Zm0-210v-60h720v60H120Zm0-210v-60h720v60H120Z"/></svg></a></li>
26+
<li class="menu-button" onclick=showSidebar()><a href="#"><svg xmlns="http://www.w3.org/2000/svg" height="26" viewBox="0 96 960 960" width="26"><path d="M120 816v-60h720v60H120Zm0-210v-60h720v60H120Zm0-210v-60h720v60H120Z"/></svg></a></li>
2727
</ul>
2828
</nav>
2929
<script>
30-
30+
function showSidebar(){
31+
const sidebar = document.querySelector('.sidebar')
32+
sidebar.style.display = 'flex'
33+
}
34+
function hideSidebar(){
35+
const sidebar = document.querySelector('.sidebar')
36+
sidebar.style.display = 'none'
37+
}
3138
</script>
3239
</body>
3340
</html>

0 commit comments

Comments
 (0)