Bootstrap的Affix菜单和子菜单 [英] Bootstrap's Affix menu with sub menus

查看:121
本文介绍了Bootstrap的Affix菜单和子菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您查看 Twitter Bootstrap的 Affix菜单,那么您会发现它也有子菜单菜单项。它们仅在您单击主菜单项之一或滚动传递与子菜单项相对应的标题时显示。

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

我的Affix菜单正在运行站点,但是我希望具有与Bootstrap站点上相同的子菜单功能。

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.

我如何实现同一目标?它是BS 3.x中的标准功能吗?还是我必须自己做?如果是这样,哪种方法更好?

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?

推荐答案

滚动部分是Bootstrap的ScrollSpy组件。要自定义 active 链接的样式,可以使用一些CSS轻松完成。.

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演示: http://bootply.com/109952

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

这篇关于Bootstrap的Affix菜单和子菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆