My nav pills can be multiple and I want to vertical scroll bar if exceed the limit of regular window/screen. I'm loading tabs dynamically and nav pills exceed screen. how can i managed to make nav pill scrollable?
/*
*
* ==========================================
* CUSTOM UTIL CLASSES
* ==========================================
*/
.nav-pills-custom .nav-link {
color: #aaa;
background: #fff;
position: relative;
}
.nav-pills-custom .nav-link.active {
color: #45b649;
background: #fff;
}
/* Add indicator arrow for the active tab */
@media (min-width: 992px) {
.nav-pills-custom .nav-link::before {
content: '';
display: block;
border-top: 8px solid transparent;
border-left: 10px solid #fff;
border-bottom: 8px solid transparent;
position: absolute;
top: 50%;
right: -10px;
transform: translateY(-50%);
opacity: 0;
}
}
.nav-pills-custom .nav-link.active::before {
opacity: 1;
}
/*
*
* ==========================================
* FOR DEMO PURPOSE
* ==========================================
*/
body {
min-height: 100vh;
background: linear-gradient(to left, #dce35b, #45b649);
}
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<!-- Demo header-->
<section >
<div >
<header >
<h1 >Bootstrap vertical tabs</h1>
<p >Making advantage of Bootstrap 4 components, easily build an awesome tabbed interface.</p>
<p >Snippet by
<a href="https://bootstrapious.com/">
<u>Bootstrapious</u>
</a>
</p>
</header>
<div >
<div >
<!-- Tabs nav -->
<div id="v-pills-tab" role="tablist" aria-orientation="vertical">
<a id="v-pills-home-tab" data-toggle="pill" href="#v-pills-home" role="tab" aria-controls="v-pills-home" aria-selected="true">
<i ></i>
<span >Personal information</span></a>
<a id="v-pills-profile-tab" data-toggle="pill" href="#v-pills-profile" role="tab" aria-controls="v-pills-profile" aria-selected="false">
<i ></i>
<span >Bookings</span></a>
<a id="v-pills-messages-tab" data-toggle="pill" href="#v-pills-messages" role="tab" aria-controls="v-pills-messages" aria-selected="false">
<i ></i>
<span >Reviews</span></a>
<a id="v-pills-settings-tab" data-toggle="pill" href="#v-pills-settings" role="tab" aria-controls="v-pills-settings" aria-selected="false">
<i ></i>
<span >Confirm booking</span></a>
</div>
</div>
<div >
<!-- Tabs content -->
<div id="v-pills-tabContent">
<div id="v-pills-home" role="tabpanel" aria-labelledby="v-pills-home-tab">
<h4 >Personal information</h4>
<p >Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div id="v-pills-profile" role="tabpanel" aria-labelledby="v-pills-profile-tab">
<h4 >Bookings</h4>
<p >Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div id="v-pills-messages" role="tabpanel" aria-labelledby="v-pills-messages-tab">
<h4 >Reviews</h4>
<p >Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div id="v-pills-settings" role="tabpanel" aria-labelledby="v-pills-settings-tab">
<h4 >Confirm booking</h4>
<p >Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</div>
</div>
</div>
</div>
</section>
MY nav pills can be multiple so my page can be stretch. here is my fiddle https://jsfiddle.net/bootstrapious/68o3pmcv/
CodePudding user response:
Try this:
/*
*
* ==========================================
* CUSTOM UTIL CLASSES
* ==========================================
*/
.nav-pills-custom .nav-link {
color: #aaa;
background: #fff;
position: relative;
}
.nav-pills-custom .nav-link.active {
color: #45b649;
background: #fff;
}
.nav {
display: block !important;
height: 300px;
overflow-y: scroll;
}
.nav a {
width: 95%;
}
.nav-pills-custom .nav-link.active::before {
opacity: 1;
}
/* Add indicator arrow for the active tab */
@media (min-width: 992px) {
.nav-pills-custom .nav-link::before {
content: '';
display: block;
border-top: 8px solid transparent;
border-left: 10px solid #fff;
border-bottom: 8px solid transparent;
position: absolute;
top: 50%;
right: -10px;
transform: translateY(-50%);
opacity: 0;
}
}
/*
*
* ==========================================
* FOR DEMO PURPOSE
* ==========================================
*/
body {
min-height: 100vh;
background: linear-gradient(to left, #dce35b, #45b649);
}
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<!-- Demo header-->
<section >
<div >
<header >
<h1 >Bootstrap vertical tabs</h1>
<p >Making advantage of Bootstrap 4 components, easily build an awesome tabbed interface.</p>
<p >Snippet by
<a href="https://bootstrapious.com/">
<u>Bootstrapious</u>
</a>
</p>
</header>
<div >
<div >
<!-- Tabs nav -->
<div id="v-pills-tab" role="tablist" aria-orientation="vertical">
<a id="v-pills-home-tab" data-toggle="pill" href="#v-pills-home" role="tab" aria-controls="v-pills-home" aria-selected="true">
<i ></i>
<span >Personal information</span></a>
<a id="v-pills-profile-tab" data-toggle="pill" href="#v-pills-profile" role="tab" aria-controls="v-pills-profile" aria-selected="false">
<i ></i>
<span >Bookings</span></a>
<a id="v-pills-messages-tab" data-toggle="pill" href="#v-pills-messages" role="tab" aria-controls="v-pills-messages" aria-selected="false">
<i ></i>
<span >Reviews</span></a>
<a id="v-pills-messages-tab" data-toggle="pill" href="#v-pills-messages" role="tab" aria-controls="v-pills-messages" aria-selected="false">
<i ></i>
<span >Reviews</span></a>
<a id="v-pills-messages-tab" data-toggle="pill" href="#v-pills-messages" role="tab" aria-controls="v-pills-messages" aria-selected="false">
<i ></i>
<span >Reviews</span></a>
<a id="v-pills-settings-tab" data-toggle="pill" href="#v-pills-settings" role="tab" aria-controls="v-pills-settings" aria-selected="false">
<i ></i>
<span >Confirm booking</span></a>
</div>
</div>
<div >
<!-- Tabs content -->
<div id="v-pills-tabContent">
<div id="v-pills-home" role="tabpanel" aria-labelledby="v-pills-home-tab">
<h4 >Personal information</h4>
<p >Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div id="v-pills-profile" role="tabpanel" aria-labelledby="v-pills-profile-tab">
<h4 >Bookings</h4>
<p >Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div id="v-pills-messages" role="tabpanel" aria-labelledby="v-pills-messages-tab">
<h4 >Reviews</h4>
<p >Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div id="v-pills-settings" role="tabpanel" aria-labelledby="v-pills-settings-tab">
<h4 >Confirm booking</h4>
<p >Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</div>
</div>
</div>
</div>
</section>