I'm trying to add transition when class "constraint" is removed
I don't understand I've added the transtion for max-height & it's not working
const container = document.getElementById('container');
const button = document.getElementById('button');
button.addEventListener('click', ()=> {
container.classList.remove("constraint");
})
.container{
max-height: auto;
background: red;
overflow: hidden;
-webkit-transition: max-height 1s ease-out;
-moz-transition: max-height 1s ease-out;
-o-transition: max-height 1s ease-out;
transition: max-height 1s ease-out;
}
.constraint{
max-height: 100px;
}
h1 {
font-size: 50px;
}
<div id="container" class="container constraint">
<h1>
Hello
</h1>
<h1>
Hello
</h1>
<h1>
Hello
</h1><h1>
Hello
</h1>
</div>
<button id="button">
expand
</button>
when expand is click the "constraint" is remove but there's no transition