Hopefully this information is useful.
#sidebar {
position: fixed;
top:0;
bottom:0;
z-index:1;
}
Also, include an overlay with the following CSS:
.overlay{
display:block;
position:fixed;
top:0;
left:0;
right:0;
bottom:0;
background-color:rgba(0,0,0,0.5)
}
$(document).ready(function() {
$('#sidebarCollapse').on('click', function() {
$('#sidebar').toggleClass('active');
$('.overlay').toggle();
});
$('.overlay').click(function() {
$('#sidebar').toggleClass('active');
$('.overlay').toggle();
});
});
@import "https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700";
body{font-family: 'Poppins', sans-serif;
background: #fafafa}
p{font-family: 'Poppins', sans-serif;
font-size: 1.1em;
font-weight: 300;
line-height: 1.7em;
color: #999;
}
a,
a:hover,
a:focus{
color: inherit;
text-decoration: none;
transition: all 0.3s;
}
.navbar{
padding: 15px 10px;
background: #fff;
border: none;
border-radius: 0;
margin-bottom: 40px;
box-shadow: 1px 1px 3px rgba(0,0,0,0.1);
}
.navbar-btn{
box-shadow: none;
outline: none!important;
border: none;
}
.line{
width: 100%;
height: 1px;
border-bottom: 1px dashed #ddd;
}
.wrapper {
display: flex;
width: 100%;
align-items: stretch;
}
#sidebar {
min-width: 250px;
max-width: 250px;
background: #7386D5;
color: #fff;
transition: all 0.3s;
position: fixed;
top:0;
bottom:0;
z-index:1;
}
#sidebar.active{
margin-left: -250px;
}
#sidebar .sidebar-header{
padding: 20px;
background: #6d7fcc;
}
...
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet" />
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<div class="wrapper">
...
</nav>
<div class="content">
...
[Content continuation]
...
</div>
</div>
<div class="overlay"></div>