CSS3 transform-origin

CSS3 transform-origin

by Wang Peng

HTML

<div class="box">click me!</div>

CSS

.box {
    background: lightblue;
    width: 200px;
    height: 200px;
    margin: 200px auto;
    transition: transform  1s  linear;
    transform-origin: 0 0;
}

.rotate{
    transform: rotate(360deg);
}

JavaScript

$(".box").on("click", function(){
    $(this).toggleClass("rotate");
})