I’ve been using Bootstrap for some time now, and absolutely love developing new sites and themes using the framework. However upon occasion there are some core functions that sometimes need alteration, and one of those is often the dropdown navigation menu.

By default Bootstrap will only show the navigation menu when the parent menu item is clicked, this is great if a parent item is a button as the users first instinct is to perform a click. However, when it comes to navigation we’ve all became quite accustomed to the hover effect.

There are several ways you can tackle this, and one of the most simple methods I use is to simply trigger a click action when the parent item gets hovered. To achieve this all is required is a simple piece of jQuery.

First, go take a look at the sample code for Bootstrap’s navigation menu and get to grips with how it’s structured. Then, add this simple piece of jQuery below to ┬ámake the drop-down show on hover.

<script>
    $('.dropdown').hover(function() {
        $('.dropdown-toggle', this).trigger('click');
    });
</script>

The code above assumes that your parent LI has the class “dropdown” assigned to it which then when hovered will trigger a click, which then triggers the default Bootstrap dropdown.