I have a horizontally scrollable navbar that works fine and now I want to add a collapse content to one of the menus. Tried to use the example in the documentation but does not work. Any ideas?
.nav-scroller {
position: relative;
z-index: 2;
height: 2.75rem;
overflow-y: hidden;
}
.nav-scroller .nav {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
padding-bottom: 1rem;
margin-top: -1px;
overflow-x: auto;
text-align: center;
white-space: nowrap;
-webkit-overflow-scrolling: touch;
}
.nav-scroller .nav-link {
padding-top: .75rem;
padding-bottom: .75rem;
font-size: .875rem;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<div class="nav-scroller py-1 mb-2">
<nav class="nav d-flex justify-content-between">
<a class="p-2 text-muted" href="">Menu 1</a>
<a class="p-2 text-muted" href="">Menu 2</a>
<a class="p-2 text-muted" href="">Menu 3</a>
<a class="p-2 text-muted" href="">Menu 4</a>
<a class="p-2 text-muted" href="">Menu 5</a>
<a class="p-2 text-muted" href="">Menu 6</a>
<a class="p-2 text-muted" href="">Menu 7</a>
<a class="p-2 text-muted" href="">Menu 8</a>
<a class="p-2 text-muted" href="">Menu 9</a>
<a class="p-2 text-muted" href="">Menu 10</a>
<a class="p-2 text-muted" data-toggle="collapse" href="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
Menu not working
</a>
<div class="collapse" id="collapseExample">
<div class="card card-body">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.
</div>
</div>
</nav>
</div>
<a class="p-2 text-muted" data-toggle="collapse" href="#collapseExample2" aria-expanded="false" aria-controls="collapseExample">
Menu working outside nav-scroller
</a>
<div class="collapse" id="collapseExample2">
<div class="card card-body">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.
</div>
</div>
question from:
https://stackoverflow.com/questions/65831107/bootstrap-4-collapse-content-inside-an-horizontally-nav-scroll 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…