I have created a dropdown menu. it works good, but there is a problem I am not able to solve on my own.
.dropdown-toggle ~ .dropdown-menu {
display: block;
opacity: 0;
-webkit-transition: all 200ms ease-in;
-moz-transition: all 200ms ease-in;
-ms-transition: all 200ms ease-in;
-o-transition: all 200ms ease-in;
transition: all 200ms ease-in;
}
.dropdown-toggle:hover ~ .dropdown-menu {
display: block;
opacity: 1;
}
<ul class="navbar-nav">
<li class="dropdown">
<a class="dropdown-toggle" href="#" id="navbardrop" data-toggle="dropdown">Test</a>
<div class="dropdown-menu">
<a class="dropdown-item" href="#">Test1</a>
<a class="dropdown-item" href="#">Test2</a>
</div>
</li>
</ul>
If I mouseover the menu - it works if the mouse is over the dropdown-toggle class. If I mouseover the element from menu - the whole menu disappear.
I know i can change dropdown-toggle to dropdown but i want to activate the menu only if mouse is over the .dropdown-toggle, not the whole container.
Do you have any idea how to do this ?