<div class="box"></div>
<button>click me</button>
.box {
background: lightblue;
width: 200px;
height: 200px;
margin: 20px auto;
transition: transform 1s linear;
transform-origin: top left;
transform-style: preserve-3D;
}
.box-rotate {
transform: rotate(360deg);
}
button {
display: block;
margin: auto;
}
$('button').click(function () {
$('.box').toggleClass('box-rotate');
});
This Pen doesn't use any external CSS resources.