<section id="wrapper">
<div id="anime_test">
</div>
<br>
<div class="push-btn" onclick="clickTest();">
PUSH
</div>
</section>
#wrapper {
display: block;
width:100%;
text-align:center;
margin:30px auto;
}
#anime_test{
height: 100px;
width: 100px;
background-color: #366cf4;
position: relative;
left: 50px;
transition: 2.5s;
border-radius: 1.5rem;
}
#anime_test.active {
background-color: #0435b0;
left: calc(100% - 150px);
border-radius: 3.5rem;
}
.anime_test-btn {
margin-top: 10px;
display: inline-block;
padding: 5px 10px;
border: solid 1px;
cursor: pointer;
}
.push-btn {
font-size: 1.0rem;
font-weight: 700;
line-height: 1.5;
position: relative;
display: inline-block;
padding: 0.5rem 2rem;
cursor: pointer;
text-align: center;
vertical-align: middle;
letter-spacing: 0.1em;
color: #fff;
border-radius: 0.5rem;
background-color: #eb6100;
}
function clickTest() {
target = document.getElementById("anime_test");
if (target.className == null || target.className=="") {
target.className = "active";
} else {
target.className = "";
}
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.