I\'m trying to make my dropdown menu open by default when my collapsed navbar is opened. Here is a fiddle to show my code so far.
Currently, if you
According to the docs for Bootstrap v3, you can use Javascript to hook on the collapse events:
$(function () {
$('#bs-example-navbar-collapse-1').on('shown.bs.collapse', function(e) {
$('#my_dropdown').dropdown('toggle', 'open').hide();
console.log('shown:', e);
});
});
I'm not sure the result is what you want, because while the "toggle" button is hidden, the submenu is still indented. Instead of trying to bend Bootstrap that much, perhaps a better solution is having 2 menus with the desired structure for each screen size and show one or another based on media queries.
Fiddle: http://jsfiddle.net/scardine/tw82o88y/