S
S
sergey2016-11-18 15:45:28
css
sergey, 2016-11-18 15:45:28

Trouble on Bootstrap mobile menu, how to overcome?

There is a project made on Bootstrap, menu items were switched on click, the client wanted the items to work on hover, and when clicked, a transition to the page was made.

I put the following code for the bootstrap menu to work on hover:

.dropdown:hover > .dropdown-menu {
  display: block;
  }
  .dropdown:hover > .dropdown-menu > li > a {
  position: relative;
  z-index: 1000;
  }

now the menu works both on hover and on a click, but on mobile extensions a jamb pops up when clicked 32dcba9f114246b0ba7aec24a00d6e7f.png
and only the second time the menu is shown correctly
f3eb2c9f3e4a4248bccd91a2997874a9.png
how to solve this trouble on mobile so that the menu opens correctly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yaroslav Ivanov, 2016-11-18
@zorro76

@media (max-width: 767px)
.navbar-nav .open .dropdown-menu {
    display: block !important;
}

@media (max-width: 767px) {
.dropdown:hover > .dropdown-menu {
    display: none;
}
}

In general, you need to hide that drop-down list at resolutions less than 767px, then there will be no duplication and will work correctly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question