How do I make my nav interactive using javascript? I want the user to click on the toggle_menu button and have the sidebar_menu appear. How do I do this with JS?
Heres my code:
HTML
<body>
<script type = "text/javascript">
function showHide {
var menu = getElementsByClassName(".toggle_menu");
var hidden = getElementsByClassName(".sidebar_menu);
toggle_menu.addEventListener('click', () => {
sidebar_menu.style.display = "block";
});
</script>
<i class = "fa fa-bars toggle_menu" onclick="showHide()"></i>
<div class = "sidebar_menu">
<i class = "fa fa-times"></i>
<center>
<a href = "#"><h1 class = "box_item">Matheus <span class = "logo_bold">Duarte</span></h1></a>
<h2 class = "logo_title">Aspiring Web Developer</h2>
</center>
<ul class = "navigation_selection">
<li class = "navigation_item"><a href="#">Home</a></li>
<li class = "navigation_item"><a href="#">AboutMe</a></li>
<li class = "navigation_item"><a href="#">Portfolio</a></li>
<li class = "navigation_item"><a href="#">Contact</a></li>
</ul>
<center>
<a href = "#"><h1 class = "box_item box_item_smaller"></h1>
<i class = "fa fa-user"></i>
Find Out More
</h1></a>
</center>
</div>