Logo Header Resizing
Hello,
i want that a logo in the navigation menu ( header ) shrink smaller when the user scroll down. Then i have more space and it looks better !!
How can i do this ??
Greetings
Stefan
Hello,
i want that a logo in the navigation menu ( header ) shrink smaller when the user scroll down. Then i have more space and it looks better !!
How can i do this ??
Greetings
Stefan
Hello Nancy,
i have try:
-webkit-transition: all 0.3s ease;
transition: all 0.3s ease;
But the Logo has no animation !!
body {
padding-top: 60px;
}
nav .navbar-brand {
font-size: 30px;
}
nav .navbar-toggle {
margin: 13px 15px 13px 0;
}
nav a {
font-size: 18px;
padding-bottom: 20px !important;
padding-top: 20px !important;
-webkit-transition: all 0.3s ease;
transition: all 0.3s ease;
}
nav.navbar.shrink {
min-height: 35px;
}
nav.navbar.shrink .navbar-brand {
font-size: 25px;
}
nav.navbar.shrink a {
font-size: 15px;
padding-bottom: 10px !important;
padding-top: 10px !important;
}
nav.navbar.shrink a img {
max-height: 25px;
max-width: 51px;
}
nav.navbar.shrink .navbar-toggle {
margin: 8px 15px 8px 0;
padding: 4px 5px;
}
Greetings
Stefan
Add a class to your image - class="logo":
<img src="pictures/logo.png" width="103" height="20" class="logo" />
Add the below css to your css styles:
.logo {
-webkit-transition: all 0.3s ease-in;
-webkit-transform: scale(1.0);
-ms-transition: all 0.3s ease-in;
-ms-transform: scale(1.0);
-moz-transition: all 0.3s ease-in;
-moz-transform: scale(1.0);
transition: all 0.3s ease-in;
transform: scale(1.0);
}
.logo_resize {
-webkit-transform: scale(0.8);
-ms-transform: scale(0.8);
-moz-transform: scale(0.8);
transform: scale(0.8);
}
Add $('.logo').addClass('logo_resize'); & $('.logo').removeClass('logo_resize'); to the function as shown below:
$(window).scroll(function() {
if ($(document).scrollTop() > 50) {
$('nav').addClass('shrink');
$('.logo').addClass('logo_resize');
} else {
$('nav').removeClass('shrink');
$('.logo').removeClass('logo_resize');
}
});
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.