Please note that Bootstrap 3 does not support submenus. See this comment from one of the original authors.

Bootstrap: Dropdown on Hover Plugin Demo

Hover over the nav items to see that they activate on hover. I'm setting the instantlyCloseOthers flag to true, so when you hover over a new nav item, the other ones instantly close (instead of waiting for their timeouts). See cameronspear.com/blog/bootstrap-dropdown-on-hover-plugin/ for more.

DIY Slidedown

Files for this are in the diy-slidedown folder, on Github. Added “do-it-yourself” CSS-transitions to the dropdown lists, making the value for padding-bottom on the dropdown-list transition from zero, (or mabybe some low value like 5px) to its full length. This works because the height value for the list has been reset to zero. This creates this custom slidedown effect, you can read more about this here.

Making the toggle-links clickable

Essential is to have data-toggle="dropdown" data-target="#" on the toggle links in the HTML-markup, in order for this to work.


 <a href="http://www.google.com" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-target="#">

From the docs for dropdowns on getbootstrap.com

the dropdown events which are fired at the .dropdown-menu's parent element.

Event Type Description
show.bs.dropdown This event fires immediately when the show instance method is called. The toggling anchor element is available as the relatedTarget property of the event.
shown.bs.dropdown This event is fired when the dropdown has been made visible to the user (will wait for CSS transitions, to complete). The toggling anchor element is available as the relatedTarget property of the event.
hide.bs.dropdown This event is fired immediately when the hide instance method has been called. The toggling anchor element is available as the relatedTarget property of the event.
hidden.bs.dropdown This event is fired when the dropdown has finished being hidden from the user (will wait for CSS transitions, to complete). The toggling anchor element is available as the relatedTarget property of the event.

One can hook into these to do something on those events:


  // effectively create two different functioning dropdowns: this is for touch
  $('.dropdown').on({

  'hide.bs.dropdown': function(e) {

  $(this).on('click', function(e) {
    var self = $(this);
    $(this).toggleClass('is-clicked').siblings('.dropdown').removeClass('is-clicked');

    if (self.hasClass('open', 'is-clicked')) {
      e.stopPropagation();
    }
    else {
      return this;
    }
  });

  }

  });

  // effectively make two different functioning dropdowns: this is for desktop, or to be precise: non-touch
  $('.dropdown').on({

  'show.bs.dropdown': function(e) {

    $(this).on('click', function(e) {

  if('ontouchstart' in document) {
        return this;
      }
      else {
        e.stopPropagation();
      }
    });
  }

  });

The javascript for this works, but probably could be improved upon, (should one use relatedTarget as suggested in the docs? Don't know, couldn’t make that work). So please let me know if there is a better way of doing this.

New! Try it with data-attributes

It also works with buttons and tabs

Just add data-hover="dropdown" where you'd put data-toggle="dropdown"

Works with button groups

This was trickier than you might think!

Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.

Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.