I created a simple tree. Elements that switch jQuery to display their children and switch the "open" class.
I have a ": before" plus sign, and when it is open, it rotates 135 degrees x, see animated gif:

As you can see, it rotates up. I want it to revolve around its center (which, in my opinion, was the default). Here is my code:
.nav-header {
color: gray;
font-weight: bold;
font-size: 16px;
padding-top: 10px;
cursor: pointer;
&:before {
content: '+';
font-size: 23px;
display: inline-block;
-webkit-transition: all .3s;
-moz-transition: all .3s;
-ms-transition: all .3s;
-o-transition: all .3s;
transition: all .3s;
}
&.open {
&:before {
-webkit-transform-origin: center center;
-moz-transform-origin: center center;
-ms-transform-origin: center center;
-o-transform-origin: center center;
transform-origin: center center;
-webkit-transform: rotate(135deg);
-moz-transform: rotate(135deg);
-ms-transform: rotate(135deg);
-o-transform: rotate(135deg);
transform: rotate(135deg);
}
Steve source
share