0
Hello! I am editing a Front of the Website of the company in which I work and I am currently in the part of the navigation menu. Every time I scroll down it "shrinks" but the Company Logo remains the same size, it doesn’t reduce along with Div.
What I need is some CSS or Javascript so that when the div shrinks, the image reduces together, preferably with some easing effect so it doesn’t get so "dry". If there is no way to reduce it, it can be a CSS/Javascript to change the image, then I put a smaller one, preferably also with an easing effect. Examples:
When you open the page:
When it rolls low pay:
I don’t know if it helps anything but I noticed that a class is inserted in the navigation menu when this transition occurs from "recollection".
Normal code:
<nav id="main-menu" class="navbar navbar-default navbar-fixed-top" role="banner">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html"><img src="./front/images/logo1.png" alt="logo"></a>
</div>
When collected, the Nav changes and looks like this (a top-Nav-Collapse):
<nav id="main-menu" class="navbar navbar-default navbar-fixed-top top-nav-collapse" role="banner">
RESOLVED
I just added it to the CSS:
.top-nav-collapse img {
padding-top: 10px;
height: 50px;
text-align: center;
transition: padding 300ms ease;
}
With your tips I managed to solve, thank you very much!
If when scrolling is added the
top-nav-collapse
image in your css. top-nav-collapse { height: 30px; width:auto}
or the height you want. If it works it speaks there– Caetano Sincero
Thanks @Caetanosincero worked in part, but I managed to solve using the tips of everyone here!
– Roger Windberg