Transition doesn't work, I want to achieve the smooth effect on scroll. I'm using the JS script below, the script is working. However, CSS transition is not.
Any help is appreciated!
window.onscroll = function() {
scrollFunction()
};
function scrollFunction() {
if (document.body.scrollTop > 550 || document.documentElement.scrollTop > 550) {
document.getElementById("header").style.height = "70px";
document.getElementById('classic-logo').style.display = "none";
document.getElementById('minifyed-logo').style.display = "block";
} else {
document.getElementById("header").style.height = "100px";
document.getElementById('minifyed-logo').style.display = "none";
document.getElementById('classic-logo').style.display = "block";
}
}
#header {
position: fixed;
width: 100%;
height: 100px;
transition: 0.3s;
}
<header id="header">
<!-- Content -->
</header>