Code: Select all
function toggleBox() {
document.getElementById("box").classList.toggle("animate");
}Code: Select all
#box {
width: 100px;
height: 100px;
background: red;
transition: transform 1s ease;
}
.animate {
transform: translateX(200px);
}Code: Select all
Toggle
Mobile version