dream hunter dream hunter - 1 year ago 70
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 )

Answer Source

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/

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download