dream hunter dream hunter - 2 months ago 8x
Javascript Question

How to rotate an icon in both directions in two clicks?

I want to rotate an icon 90 degree clock wise direction on first click and 90 degree anticlockwise on second click. (remember that the icon can load using either

tag or
tag )


Try this

<a href="#"><div class="fa fa-anchor  rotation_90deg"></div></a>

Add to css classes like below

   -moz-transition: all 2s linear;
   -webkit-transition: all 2s linear;
   transition: all 2s linear;


And in your script

  $(this).toggleClass("down")  ; 

working fiddler http://jsfiddle.net/zakirshakir/3v2egwfs/790/