Bootstrap's Affix menu with sub menus

牧云@^-^@ 提交于 2019-12-01 12:58:15

问题


If you take a look at Twitter Bootstrap's Affix menu, then you'll see that it also has sub menu items. They only show when you click on one of the main menu items or when you scroll pass the titles that correspond to the sub menu item

I have an Affix menu working on my site, but I would like to have the same sub menu functionality as you see on the Bootstrap site.

How can i achieve the same thing? Is it standard functionality in BS 3.x? Or do I have to do this my self? If so, what would be a good approach?


回答1:


The scroll part is Bootstrap's ScrollSpy component. To customize the style of the active link can be easily done with a little CSS..

/* hide sidebar sub menus by default */
#sidebar.nav .nav {
    display: none;
    font-size:12px;
}

/* show sub menu when parent is active */
#sidebar.nav>.active>ul {
    display: block;
}

Bootply demo: http://bootply.com/109952



来源:https://stackoverflow.com/questions/21490369/bootstraps-affix-menu-with-sub-menus

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!