I have a container as a header of a collapsible dropdown with a max-height of 30px. I'm toggling an ".open" class that changes the max-height to 30000px onClick in Javascript.
I'm trying to add a CSS transition to make this more fluid via transition: 1s; to the container class. The resulting effect is clunky and seems wrong: the div will collapse instantly (no ease-in/out) after a timeout equal to the 1s in the css element. I.e. if I add transition: 5s;, nothing will happen on the page until 5s, then the div will snap closed.
Hope this makes sense, thank you!
-- Sharing code for clarity:
html:
<section class="project">
    <div class="project-head">
       imgs/text with flexbox/grids etc
    </div>
</section>
css:
section.project {
  max-height: 30px;
  overflow: hidden;
  transition: all 0.5s ease-in-out;
}
.project-head {
    display: grid;
    height: 50px;
    width: 95vw;
    transition: .01s;
}
.open {
  max-height: 100000px !important;
}
js:
document.querySelectorAll('.project-head').forEach(project => {
    project.addEventListener('click', function () {
      this.parentElement.classList.toggle("open");
    });
})
 
    