简体   繁体   English

Bootstrap 4使导航栏项目始终在小屏幕上扩展且没有按钮

[英]Bootstrap 4 to have navbar items allways expanded on small screen with no button

I am working on a website footer, and am looking for a way to make a nav that has all it's items in one row on a large screen, and collapsed to many rows on a smaller screen. 我正在网站脚注上工作,正在寻找一种制作导航器的方法,该导航器将所有物品在大屏幕上排成一排,然后在小屏幕上折叠成多排。 The collapsing happens just fine, but I cannot figure out a way to: 崩溃发生的很好,但是我无法找出一种方法来:

a) automatically show the rows and not have them hidden until the toggle button is hit a)自动显示行,直到单击切换按钮时才隐藏行

b) eliminate the toggle button all together b)完全消除切换按钮

My current code: 我当前的代码:

 <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" rel="stylesheet"/> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script> <nav class="navbar navbar-dark bg-dark navbar-expand-xl py-0" id="footerBar"> <div class="collapse navbar-collapse" id="navbarColor03"> <ul class="navbar-nav mr-auto"> <li class="nav-item"> <a class="nav-link" href="#" target="_blank">link1</a> </li> <li class="nav-item"> <a class="nav-link" href="#">link2</a> </li> </ul> </div> </nav> 

Currently, this just collapses into nothing without a button (obviously because I have removed it). 目前,没有按钮就无法折叠(显然是因为我已将其删除)。 Is there an easy way to make it default to expanded on smaller screens? 有没有一种简单的方法可以使其默认扩展到较小的屏幕?

Figured it out... 弄清楚了...

Needed the "show" class applied to the collapse (the div with id navbarColor03 ). 需要将“ show”类应用于折叠(ID为navbarColor03的div)。

 <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" rel="stylesheet"/> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script> <nav class="navbar navbar-dark bg-dark navbar-expand-xl py-0" id="footerBar"> <div class="collapse navbar-collapse show" id="navbarColor03"> <ul class="navbar-nav mr-auto"> <li class="nav-item"> <a class="nav-link" href="#" target="_blank">link1</a> </li> <li class="nav-item"> <a class="nav-link" href="#">link2</a> </li> </ul> </div> </nav> 

暂无
暂无

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

相关问题 使引导导航栏成为小屏幕上的下拉菜单 - Make bootstrap navbar become a dropdown on small screen Bootstrap Navbar 在小屏幕上变得透明 - Bootstrap Navbar becomes transparent on small screen Bootstrap NavBar不透明性,适用于小屏幕和大屏幕 - Bootstrap NavBar opacity for small and large screen 确定Bootstrap中的导航栏是否已展开 - Determine if navbar in Bootstrap is expanded or not 如何在使用引导程序创建的小屏幕上修复重叠的导航栏元素? - How to fix the overlapping navbar elements on small screen created using bootstrap? bootstrap 导航栏总是折叠起来,但在展开时,需要显示屏幕宽度较短时显示的宽度 - bootstrap navbar always collapsed but when expanded, need to show the width as it is shown when the screen width is shorter 将徽标添加到导航栏品牌后,Bootstrap 4 导航栏切换按钮在小屏幕上切换到新行 - Bootstrap 4 Navbar Toggler Button shifting to new line on small screens after adding logo to Navbar Brand 在大屏幕上悬停时,Bootstrap 4导航栏打开下拉菜单,但在小屏幕上单击即可打开 - Bootstrap 4 navbar open dropdown when hover on big screen, but blick to open on small screen 反应引导导航栏折叠汉堡按钮不显示导航项目 - react bootstrap navbar collapse hamburger button does not show nav items 折叠的导航栏仍在Twitter Bootstrap网站上扩展 - collapsed navbar remains expanded on a Twitter Bootstrap website
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM