Rename local variable, add more to docs, fix value inconsistency, move class from first demo, link to the demo from up top
This commit is contained in:
parent
b12f544c61
commit
7cb1429313
2 changed files with 29 additions and 31 deletions
|
|
@ -115,11 +115,6 @@
|
|||
width: 100%;
|
||||
}
|
||||
|
||||
.navbar-nav-scroll {
|
||||
max-height: var(--height, 70vh);
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
// Button for toggling the navbar when in its collapsed state
|
||||
.navbar-toggler {
|
||||
padding: $navbar-toggler-padding-y $navbar-toggler-padding-x;
|
||||
|
|
@ -153,6 +148,11 @@
|
|||
background-size: 100%;
|
||||
}
|
||||
|
||||
.navbar-nav-scroll {
|
||||
max-height: var(--bs-scroll-height, 75vh);
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
// Generate series of `.navbar-expand-*` responsive classes for configuring
|
||||
// where your navbar collapses.
|
||||
.navbar-expand {
|
||||
|
|
@ -179,6 +179,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
.navbar-nav-scroll {
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.navbar-collapse {
|
||||
display: flex !important; // stylelint-disable-line declaration-no-important
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ Navbars come with built-in support for a handful of sub-components. Choose from
|
|||
- Flex and spacing utilities for any form controls and actions.
|
||||
- `.navbar-text` for adding vertically centered strings of text.
|
||||
- `.collapse.navbar-collapse` for grouping and hiding navbar contents by a parent breakpoint.
|
||||
- Add an optional `.navbar-scroll` to set a `max-height` and scroll on navbar content.
|
||||
- Add an optional `.navbar-scroll` to set a `max-height` and [scroll expanded navbar content](#scrolling).
|
||||
|
||||
Here's an example of all the sub-components included in a responsive light-themed navbar that automatically collapses at the `lg` (large) breakpoint.
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ Here's an example of all the sub-components included in a responsive light-theme
|
|||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse navbar-nav-scroll" id="navbarSupportedContent">
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="#">Home</a>
|
||||
|
|
@ -480,50 +480,44 @@ Also note that **`.sticky-top` uses `position: sticky`, which [isn't fully suppo
|
|||
|
||||
## Scrolling
|
||||
|
||||
Add `.navbar-nav-scroll` to a `.navbar-nav` to enable vertical scrolling when expanded navbar content gets too tall. By default, scrolling kicks in at `75vh` (or 75% of the viewport height), but you may override that with a local CSS custom property. For example, add `style="--height: 65vh;"` to the `.navbar-nav`.
|
||||
Add `.navbar-nav-scroll` to a `.navbar-nav` to enable vertical scrolling within the toggleable contents of a collapsed navbar. By default, scrolling kicks in at `75vh` (or 75% of the viewport height), but you may override that with the local CSS custom property `--bs-navbar-height` or custom styles. At larger viewports, when the navbar is expanded, content will appear as in a default navbar.
|
||||
|
||||
Please note that this behavior comes with a potential drawback of `overflow`—when setting `overflow-y: auto` (required to scroll the content here), `overflow-x` is the equivalent of `auto`, which will crop some horizontal content.
|
||||
|
||||
Here's an example navbar using `.navbar-nav-scroll` with `style="--bs-scroll-height: 100px;"` or `style="max-height: 100px"`.
|
||||
|
||||
{{< example >}}
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="#">Navbar scroll</a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarScroll" aria-controls="navbarScroll" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarScroll" aria-controls="navbarScroll" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarScroll">
|
||||
<ul class="navbar-nav mr-auto mb-2 mb-lg-0 navbar-nav-scroll">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0 navbar-nav-scroll" style="--bs-scroll-height: 100px;">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="#">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Link</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Link</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Link</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Link</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Link</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Link</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Link</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Link</a>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
Dropdown
|
||||
</a>
|
||||
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
|
||||
<li><a class="dropdown-item" href="#">Action</a></li>
|
||||
<li><a class="dropdown-item" href="#">Another action</a></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li><a class="dropdown-item" href="#">Something else here</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a>
|
||||
</li>
|
||||
</ul>
|
||||
<form class="d-flex">
|
||||
<input class="form-control mr-2" type="search" placeholder="Search" aria-label="Search">
|
||||
<input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
|
||||
<button class="btn btn-outline-success" type="submit">Search</button>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue