I've successfully created a navigation menu that expands and collapses without using a dropdown feature. However, I'm encountering an issue where I can't seem to toggle the div when clicking on a menu link. I attempted to use JavaScript to close the div upon clicking a link, but then I face difficulty reopening the menu.
Below is the HTML code for my navigation menu:
<header style="padding:0px 0%;">
<nav class="navbar navbar-inverse navbar-static-top" style="margin:0px 0px;">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header hidden-md hidden-lg">
<button type="button" class="navbar-toggle collapsed hidden-sm hidden-xs" data-toggle="collapse" data-target="#myNavmenu" aria-expanded="true" style="color:#fff;display:inline-block;">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right inverse hidden-xs hidden-sm" style="margin:0px 0px; font-size:0.8em;">
<li style="float:left !important"><a href="/" style="text-align: left; padding:8px 0px;"><img src="/products/greg2/images/avatierwatermark.png" style="height:34px; width:auto;"></a></li>
<li><a href="#">Customers</a></li>
<li><a href="#">Solutions</a></li>
<li><a href="#">Products</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
</header>
<div class="collapse" id="expandmenu">
<div class="well">
<div class="container">
<button type="button" class="navbar-toggle2 pull-right" data-toggle="collapse" href="#expandmenu" aria-expanded="false" aria-controls="collapseExample" style="float:right; padding:16px 5px 17px 0px; color:#333;"><p class="explore" style="font-size:0.8em; color:#333;">Close </p>
<span class="glyphicon glyphicon-remove" aria-hidden="true" style="font-size:1.1em;"></span>
</button>
<div class="row">
<div class="col-sm-12">
</div>
</div>
<div class="row">
<ul class="expand txt-ctr" style="padding-left:0px;">
<li class="blue"><a href="#passwordstationbenefits" data-toggle="collapse" aria-expanded="false" aria-controls="collapseExample"><div style="background-position:0px 0px;"></div><span>Benefits</span></a></li>
<li class="blue"><a href="#overview" data-toggle="collapse" aria-expanded="false" aria-controls="collapseExample"><div style="background-position:-165px 0px;"></div><span>Overview</span></a></li>
<li class="blue"><a href="#design"><div style="background-position:-330px 0px;"></div><span>Features</span></a></li>
<li class="blue"><a href="#reporting"><div style="background-position:-495px 0px;"></div><span>Reports</span></a></li>
<li class="blue"><a href="#security"><div style="background-position:-660px 0px;"></div><span>Security</span></a></li>
<li class="blue"><a href="#helpdesk"><div style="background-position:-825px 0px;"></div><span>Help Desk</span></a></li>
<li class="blue"><a href="#appsupport"><div style="background-position:-990px 0px;"></div><span>App Support</span></a></li>
<li class="blue"><a href="#architecture"><div style="background-position:-1155px 0px;"></div><span>Architecture</span></a></li>
<li class="blue"><a href="#languages"><div style="background-position:-1315px 0px;"></div><span>Languages</span></a></li>
<li class="blue"><a href="#ticketing"><div style="background-position:-1490px 0px;"></div><span>Ticketing</span></a></li>
<li class="blue"><a href="#textimonials"><div style="background-position:-1665px 0px;"></div><span>Testimonials</span></a></li>
<li class="blue"><a href="/products/identity-management/password-management/password-station/demo/"><div style="background-position:-1825px 0px;"></div><span>Demo</span></a></li>
<li class="blue"><a href="#resources"><div style="background-position:-1998px 0px;"></div><span>Resources</span></a></li>
<li class="blue"><a href="#payingtwice"><div style="background-position:-2165px 0px;"></div><span>True Cost</span></a></li>
</ul>
</div>
</div>
</div>
</div>
And here's the JavaScript code snippet that I have experimented with:
$('.collapse a').click(function(){
$("#expandmenu").toggle();
});
Your assistance in resolving this issue is greatly appreciated!