Bootstrap navbar justify / span menu items occupying full width

前端 未结 6 1340
粉色の甜心
粉色の甜心 2020-12-08 00:38

I use the default Twitter Bootstrap responsive navbar (without the logo and search), but I want the menu items to be spanned, occupying the full width of the menu bar.

6条回答
  •  伪装坚强ぢ
    2020-12-08 01:42

    this last example here, doesn't work for me either, the dropdownmenu always appears at the first li element.

    setting the width of the main li elements with jquery is the only thing that worked for me, along the lines of

    setNavWidth: function(){
        var wi = parseInt(($('#navcontainer').width()-48)*.25);
        for( var i = 0 ; i < 4; i++){
            $('#carvernavli_'+i).width(wi);
        }
    
    }
    

    so i have 4 main li elements and gave them an id, the "navcontainer" ist the container wrapping the navigation directly underneath "navbar-inner". you also have to call this function on window resize, than it works !

提交回复
热议问题