Bootstrap 3 multiple menus collapse into one for mobile

前端 未结 2 1008
失恋的感觉
失恋的感觉 2020-12-29 16:51

I have been fighting with menus for a while now. What I want is both a top menu and a side menu. And in order to be useful on mobile devices, both menus need to collapse int

2条回答
  •  情歌与酒
    2020-12-29 17:17

    I know this is an older post but still the best answer to a similar question I had present day, I had to modify one small thing though to make it work properly for me. Everything worked as intended except the line

    $('#bs-example-navbar-collapse-1 ul:last-child').remove();
    

    This would for some weird reason remove literally the last child of every ul in the menu so to correct it just added an id to the aside ul and used that selector to remove the menu which worked out a bit better especially if combining more than one menu. Thank you very much for the solution though! Bass Jobsen! Only going to post the modified lines since Bass already has the answer posted.

    in the html:

    and in the javsacript:

    $('#bs-example-navbar-collapse-1 #sideMenu1').remove();
    

提交回复
热议问题