I created a dropdown menu click, but it have a little weirdness. When I click the button dropdown, the dropdown menu has appear. But when I move my cursor to another (without click the button dropdown again), the dropdown menu dissapear and it has become hoverable dropdown menu not dropdown menu click (Sorry for my bad English)
How can I make the dropdown menu click always appear when I click the button dropdown and move the cursor?
(Here is my code)
HTML
<aside class="sidebar">
<ul>
<li><a href="#"><i class="material-icons">home</i>Homepage</a></li>
<li class="button_dropdown"><a href="javascript:void(0)" class="dropdown-toggle"><i class="material-icons">widgets</i>Events Organizer <i class="material-icons multi_menu">keyboard_arrow_right</i></a>
<ul class="dropdown_menu">
<li><a href="#">Create Events</a></li>
<li><a href="#">List Events</a></li>
</ul>
</li>
<li><a href="#"><i class="material-icons">people</i>Peserta Events</a></li>
</ul>
</aside>
CSS
aside.sidebar ul li ul.dropdown_menu {
opacity: 0;
visibility: hidden;
height: auto;
width: 100%;
margin-top: -1px;
position: absolute;
transition: all 0.5s;
border-left: 1px solid #2c3e50;
background-color: #34495e;
}
aside.sidebar ul li ul.dropdown_menu.active {
opacity: 1;
visibility: visible;
height: auto;
width: 100%;
background-color: #34495e;
left: 100%;
top: 0;
transition: all 0.5s;
}
Jquery
$(document).ready(function () {
$(".button_dropdown").click(function () {
$(".dropdown_menu").toggleClass("active");
});
});



left:100%.aside.sidebar ul li ul.dropdown_menuset toleft:100%. This is causing theulto be off the screen due to being 100% across the page from the left. Set it to your width ofsidebaras shown in my answer below.