I am trying to trigger a transition by toggling a class. The class toggles and applies it's style to the element, but the transition does not trigger. The transition applies to all properties, so I don't think that that is the problem.
function expandFunction(element) {
element.classList.toggle("setHeightStyle");
}
.setHeightStyle {
height: 60px;
}
#expSect1 {
overflow: hidden;
cursor: pointer;
transition: 1s;
}
<div class="setHeightStyle" id="expSect1" onclick="expandFunction(this)">
<h1>Title</h1>
<br>
<p>Content!<br>More content!</p>
</div>