Take a look at this functional demo :)
If you check out the example here on stackoverflow, make sure to view it in full page mode :)
$(window).scroll(()=>{
let distance = $('#header').offset().top;
if(distance > 150){
$('#logo').addClass('header-image-scroll');
$('#nav-collection').addClass('navbar-scroll');
}
else {
$('#logo').removeClass('header-image-scroll');
$('#nav-collection').removeClass('navbar-scroll');
}
})
#header {
height: 120px;
}
#nav-collection {
transition: margin 300ms ease-in-out;
font-size: .80rem;
}
#nav-collection li {
padding: 5px;
margin-right: 30px;
}
#logo{
height: 80%;
width: auto;
transition: transform 300ms ease-in-out;
}
.header-image-scroll{
transform: scale(0.7);
}
.navbar-scroll {
margin-top: -25px;
}
.content {
height: 100vh;
}
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<nav class="navbar navbar-expand-md navbar-light sticky-top bg-white">
<div class="container-fluid p-0">
<button class="navbar-toggler my-2" type="button" data-toggle="collapse" data-target="#navbarCollapse">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse flex-column align-items-center text-center ml-lg-2 ml-0" id="navbarCollapse">
<ul class="navbar-nav flex-row mb-md-1 mt-md-0 mb-3 mt-2">
<li class="nav-item">
<div id="header" class="d-flex align-items-center justify-content-center">
<img src="https://logos-download.com/wp-content/uploads/2016/11/The_New_Yorker_logo.png" id="logo">
</div>
</li>
</ul>
<ul class="navbar-nav justify-content-center w-100 border-top border-bottom font-weight-bold" id="nav-collection">
<li class="nav-item active">
<a class="nav-link" href="#">News</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Culture</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Books</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Business & Tech</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Humor</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Cartoons</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Magazine</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Video</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Podcasts</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="content"></div>