Answer the question
In order to leave comments, you need to log in
Dropdown menu missing?
Registered on the site through html using bootstrap 4 the main menu with a drop-down. When you select a drop-down, it disappears if you poke in another place or on some of its sub-items. What to do to prevent this from happening?
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
О нас
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="http://cw68466.tmweb.ru/index.php/o-nas">О компании </a>
<a class="dropdown-item" href="http://cw68466.tmweb.ru/index.php/otzyvy34453534">Отзывы</a>
</div>
<li class="nav-item active">
<a class="nav-link" href="http://cw68466.tmweb.ru/index.php/kontakty">Контакты</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="http://cw68466.tmweb.ru/index.php/izbrannoe"><span class="oi oi-star" title="star" aria-hidden="true"></span>Избранное</a>
</li>
</li>
Answer the question
In order to leave comments, you need to log in
for example, hang the .noclose class on
and handler:<li class="nav-item dropdown">
$(document).on('click','.noclose',function(e){
e.stopPropagation();
});
Registered in the code <li class="nav-item dropdown noclose">
at the end of bootstrap.js
$(document).on('click','.noclose',function(e){
e.stopPropagation();
});
When clicking outside the menu item, for some reason, a style is attached to it that hides this element:
Look, in some of the connected js, hiding works for you. Something tells me that legs grow from here .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question