Skip to content
Advertisement

Bootstrap Dropdown with Hover

OK, so what I need is fairly straightforward.

I have set up a navbar with some dropdown menus in it (using class="dropdown-toggle" data-toggle="dropdown"), and it works fine.

The thing is it works “onClick“, while I would prefer if it worked “onHover“.

Is there any built-in way to do this?

Advertisement

Answer

The easiest solution would be in CSS. Add something like…

.dropdown:hover .dropdown-menu {
    display: block;
    margin-top: 0; /* remove the gap so it doesn't close */
}

Working Fiddle

Advertisement