As indicated in the title, my goal is to have an image move to a sticky-top
bootstrap navbar when scrolling. Below is a sample code snippet:
.mainlogo{
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
}
/* header */
.navbar{
height: 100px;
background-color: #0D4671;
}
.img{
display: inline;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" href="styles/main.css">
<div class="container">
<div class="mainlogo">
<img src="https://images.pexels.com/photos/1098662/pexels-photo-1098662.jpeg" alt="" class=" w-100">
</div>
</div>
<nav class="navbar sticky-top navbar-expand-lg">
<div class="container">
<a class="navbar-brand" href="#">
<img src="https://images.pexels.com/photos/1098662/pexels-photo-1098662.jpeg" alt="" width="30" height="30" class="logo">
A Car
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricing</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container">
<h1>Loremlorem</h1>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Qui atque magni consectetur! Modi, quia inventore, voluptates eligendi at ipsum commodi perferendis neque, incidunt fugit cupiditate labore molestiae omnis nihil? Voluptatibus.</p>
<p>... (more lorem ipsum text) ...</p>
</div>