My onclick
event is acting strange. Whenever I click the mobile menu in the menubar, it just appears briefly like a flash and then disappears. It's not staying stable on the screen. The classes are being added and removed abruptly when I try to click the menu bar. I'm having trouble understanding what's wrong with the click function. Can you please recommend a solution to help me deal with this issue?
Below is the code snippet:
.shown {
display: block !important;
}
.mobile-menu {
position: absolute;
z-index: 999;
height: 100vh;
width: 100%;
background: #e4e3e3;
top: 0;
left: 0;
line-height: 2;
display: none;
overflow: hidden;
z-index: 9999;
}
.mobile-menu .menu-list {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 70vh;
width: 100%;
}
.mobile-menu .menu-list .menu-item {
width: 100%;
text-align: center;
}
.mobile-menu .menu-list .menu-item .menu-link {
font-size: 22px !important;
text-decoration: none;
cursor: pointer;
font-weight: 700;
display: block;
transition: all .5s ease;
color: #00A139;
}
.mobile-menu .menu-list .menu-item .menu-link:hover {
color: #ffffff;
background: #00A139;
}
<!-- mobile menu -->
<div id="menus" class="mobile-menu">
<ul class="menu-list">
<li class="menu-item">
<a class="menu-link" href="products.html">PRODUCTS</a>
</li>
<li class="menu-item">
<a class="menu-link" href="sustainability.html">SUSTAINABILITY</a>
</li>
<li class="menu-item">
<a class="menu-link" href="compliance.html">COMPLIANCE</a>
</li>
<li class="menu-item">
<a class="menu-link" href="investors.html">INVESTORS</a>
</li>
<li class="menu-item">
<a class="menu-link" href="about.html">ABOUT</a>
</li>
<li class="menu-item">
<a class="menu-link" href="contact.html">CONTACT</a>
</li>
</ul>
</div>
<!-- End mobile menu -->
<a href="" id="myBtn" class="humburger d-lg-none d-md-none">
aaaaaa
</a>