I want to add a class to a div, in an animated way!
const divnew = document.createElement("div");
divnew.classList.add("circle");
const beans = document.getElementById("beans");
beans.append(divnew);
divnew.classList.add("up");
.circle{
background:#FCD299;
border-radius:50%;
width:50px;
height:50px;
position:relative;
top:300px;
left: 500px;
transition:all 300ms;
}
.circle.up{
position:relative;
top:200px;
left: 500px;
}
<div id="beans"></div>
as you can see, it adds a class to a div, and then i want it to add the class up
in an animation way. But it doesnt do that. help