I have looked throught at least 10 threads here and I didn't find the solution. What I'm trying to do is change the height property with transition which is supposed to be triggered by my JavaScript code. That doesn't happen though.
nav {
background: rgb(242, 242, 242);
border-radius: 0px 0px 15px 15px;
display: none;
height: 0px;
margin-top: 68px;
overflow: hidden;
position: fixed;
top: 0;
width: 100%;
z-index: 1;
transition: height 1s ease;
}
var button = document.getElementsByTagName('button')[0];
var image = document.getElementsByTagName('img')[0];
var bar = document.getElementById('bar');
var nav = document.getElementsByTagName('nav')[0];
var clicks;
button.onclick = function() {
if (clicks <= 0 || clicks === undefined || clicks === null) {
nav.style.display = 'block';
nav.style.height = 'auto';
bar.style.borderRadius = '0px';
image.src = 'assets/image/chevron-up.png';
clicks++;
}
else {
nav.style.display = 'none';
nav.style.height = '0px';
bar.style.borderRadius = '0px 0px 15px 15px';
image.src = 'assets/image/menu-three-horizontal-lines-symbol.png';
clicks = 0;
}
}
Why? How do I fix this?
autovalue isn't animatable.displayproperty as it's not animatable thus no transitions occurs.