makes nav-pills collapsable just like nav-bar in bootstrap

后端 未结 6 894
执念已碎
执念已碎 2020-12-08 05:33

we are developing an application and we are using twiiter bootstrap 3 we have created a navigation bar with nav-pills

   
6条回答
  •  心在旅途
    2020-12-08 06:04

    @Tricky12 has a good solution, i used for myself, just changed the last part.

    //Unstack menu when not collapsed
    $('#bs-example-navbar-collapse-1').on('hidden.bs.collapse', function() {
        $('.nav-pills').removeClass('nav-stacked');
    });
    

    The part: hidden.bs.collapse trigger when the menu is fully closed, while hide.bs.collapse trigger when it starting to close.

    if you trigger the .removeClass('nav-stacked'); before collapsed menu it fully closed, will show the horizontal menu for a fraction of a second before is fully closed.

    Hope this will help someone.

提交回复
热议问题