I am trying to replicate the css transition here.
Similar to the example, I have created:
<span onclick="document.getElementById('box').classList.toggle('grow');">Go</span>
<div class="box"></div>
.box {
width: 150px;
height: 150px;
background-color: red;
border: 1px solid #000;
transition-property: all;
transition-duration: .5s;
transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
}
.grow {
width: 350px;
}
https://jsfiddle.net/swrhho41/15/
However, this doesnt seem to work. The grow class isn't being added to the div.
Is there more JS that is needed?
onclickhandler is looking for a div with an ID of 'box' and you're HTML has a div with a class of 'box'.