SideNav with dropdown not Closing On Click
See original GitHub issueHi, My SideNav only closes when I click direct links, but not within dropdown links. My code:
<div class="navbar-fixed">
<nav class="teal lighten-2" role="navigation">
<div class="container">
<div class="nav-wrapper">
<div>
<ul id="solution1" class="dropdown-content">
<li><a href="#" class="">Home</a></li>
<li><a href="#card" class="">Benefits</a></li>
<li><a href="#platform" class="">Plataform</a></li>
<li><a href="#security" class="">Security</a></li>
<li><a href="#report" class="">Report</a></li>
</ul>
<ul id="language1" class="dropdown-content">
<li><a href="index_en-us.html" class="">English </a></li>
<li><a href="index_pt-br.html" class="">Português </a></li>
<li><a href="index_es-es.html" class="">Español </a></li>
</ul>
</div>
<a id="logo-container" href="#" class="brand-logo"><img src="img/PhishX-Logo-Hor.png" alt="PhishX Logo" height="66" width="150" /></a>
<a href="" data-activates="nav-mobile" class="button-collapse"><i class="mdi-navigation-menu white-text"></i></a>
<ul id="nav-desktop" class="right hide-on-med-and-down teal lighten-2 white-text">
<b>
<li><a class="dropdown-button white-text" href="#!" data-activates="solution1">Solution <i class="mdi-action-dashboard right"></i></a></li>
<li><a href="#try" class="white-text">Contact <i class="mdi-action-perm-contact-cal right"></i></a></li>
<li><a class="dropdown-button white-text" href="#!" data-activates="language1">Language <i class="mdi-action-language right"></i></a></li>
<li><a href="https://portal.phishx.com/" class="white-text" target="_blank">Portal <i class="mdi-action-exit-to-app right"></i></a></li>
</b>
</ul>
<ul id="nav-mobile" class="right side-nav teal lighten-2 white-text">
<b>
<li><a class="dropdown-button white-text" href="#!" data-activates="solution1">Solution <i class="mdi-action-dashboard right"></i></a></li>
<li><a href="#try" class="white-text">Contact <i class="mdi-action-perm-contact-cal right"></i></a></li>
<li><a class="dropdown-button white-text" href="#!" data-activates="language1">Language <i class="mdi-action-language right"></i></a></li>
<li><a href="https://portal.phishx.com/" class="white-text" target="_blank">Portal <i class="mdi-action-exit-to-app right"></i></a></li>
</b>
</ul>
</div>
</div>
</nav>
</div>
My init.js:
… $(‘.button-collapse’).sideNav({ closeOnClick: true, ‘edge’: ‘left’ }); $(‘.collapsible’).collapsible(); …
Issue Analytics
- State:
- Created 9 years ago
- Comments:11 (1 by maintainers)
Top Results From Across the Web
Avoid dropdown menu close on click inside - Stack Overflow
First by handling the click on the link to open/close the dropdown like this : ... I just add onclick event like below...
Read more >How to avoid dropdown menu to close menu items on clicking ...
In this article, We will use stropPropagation method to prevent the dropdown menu from closing the menu list.
Read more >Off clicking above dropdown does not close ... - GitLab
When opening an item in the group issue board sidebar, off clicking above the context does not close the dropdown. This has to...
Read more >Navbar dropdown menus not closing at click
I'm looking for an API to close dropdown menu with animation. The problem is probably because you have system animations turned off.
Read more >How To Create a Side Navigation Dropdown - W3Schools
Click on the dropdown button to open the dropdown menu inside the side navigation. This sidebar is of full height (100%) and always...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Just add on click event to a tag:
<a href="#section-contact" onclick="$('.button-collapse').sideNav('hide');">Home</a>
Use this script.