简体   繁体   English

如何使用引导程序显示另一个导航栏而不是下拉菜单

[英]How to show another navbar instead of dropdown menu using bootstrap

Instead of having individual navbar items having dropdown lists can I have the list shown as another extra navbar just below it? 除了让单个导航栏项目具有下拉列表之外,我还可以将列表显示为紧靠其下的另一个导航栏吗?

something like how apple does here http://www.apple.com/mac/ 像苹果在这里的样子http://www.apple.com/mac/

The best way to do this is to create a Div underneath your primary menu and to insert your sub-menu items inside that child div. 最好的方法是在主菜单下创建一个Div,并将子菜单项插入该子div中。

Of course, the actual implementation depends on the actual use case, the goals of the aesthetic and the user experience. 当然,实际的实现方式取决于实际的使用情况,美学目标和用户体验。

You could do a JS onClick event that will trigger the child dive to be inserted when hovering on the parent, or do it in pure CSS with a:hover and changing display of the other div. 您可以执行JS onClick事件,将其悬停在父级上时触发插入子级潜水,或者在纯CSS中使用a:hover并更改另一个div的显示来进行。

Since you are asking specifically Bootstrap, the simplest implementation would be for you to grab a Mega Menu and tweak it to fit your Use Case. 由于您是专门问Bootstrap的,因此最简单的实现是让您获取Mega Menu并对其进行调整以适合您的用例。

YAMM is very good, all you would need to do to achieve what you want is to set a grid to your sub-menu items whilst having the sub-menu wrapper match the parent nav width. YAMM非常好,您要做的就是在子菜单项与父导航宽度匹配的同时为子菜单项设置网格。

Of course, I would recommend you read the documentation and understand how it is implemented and try to come up with your own solution to fit your particular Use Case. 当然,我建议您阅读文档并了解其实现方式,并尝试提出自己的解决方案以适合您的特定用例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM