This is my first time asking for help as I usually find the answers myself, but this issue has me stumped.
Here's what I have:
HTML
<!-- This div opens/shows the navigation. I need to change the div to a button tag -->
<div class="menu"><a id="menu-open" class="menu-open" href="#">☰</a></div>
<nav id="navigation" class="navigation">
<!-- This button closes/hides the navigation -->
<button type="button" value="Close" class="button-close">
<a id="menu-close" class="menu-close">X</a>
</button>
<h1>User Name</h1>
<p class="mail"><sec:authentication property="principal.username" /></p>
</nav>
CSS
.navigation {
position: fixed;
background: #fff;
width: 100%;
height: 100vh;
top: 0;
z-index: -100;
display: none;
text-align: center;
font-weight: bold;
}
.navigation-open {
z-index: 100;
display: inherit;
}
jQuery
$(document).ready(function(){
$(".menu-open").click(function(){
$(".navigation").toggleClass("navigation-open")
});
$(".menu-close").click(function(){
$(".navigation").toggleClass("navigation-open")
});
});
Clicking on the menu-open link toggles the visibility of the navigation element, however, clicking on the menu-close link does not toggle it back off immediately after in IE and FF browsers, unlike in Chrome.
I am using Chrome 52, IE 11, and FF 46.
What I've tried so far:
- Switching from jQuery version 1.x to 3.x
- Using e.stopPropagation() function and redirecting the handling to html
Any help on resolving this issue would be greatly appreciated!
Thank you in advance!