Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Menu in Bootstrap 4 disappears when the mouse movement is slow

I'm running this fiddle and when the mouse pointer moves quickly from from START to the unfolded menu, everything works great. However, when the movement is slower, the menu closes because it feels like the mouse's left.

const menu = $("li.dropdown");
menu.on("mouseenter mouseleave", () => {
  menu.toggleClass("open");
});

Initially, I tried to make the list item control taller but realized quickly that the menu will open below it (plus this unfortunate vertical distance).

What can I do about it?

Apparently Bootstrap creators found this good for some reason (or didn't think about mouse movements but rather clicking). Am I setting up the hover event in an inappropriate way, perhaps?

like image 377
Konrad Viltersten Avatar asked Mar 10 '23 07:03

Konrad Viltersten


2 Answers

for me is better this solution

here is the fiddle

.open>.dropdown-menu{
    margin-top: initial;
}
like image 111
Emiliano Avatar answered Apr 26 '23 00:04

Emiliano


This css fixed it for me (Bootstrap v4.3.1):

div.dropdown-menu {
    margin-top: 0 !important;
}
like image 34
qwertz Avatar answered Apr 26 '23 00:04

qwertz