0

I am trying to make a funny function that rotates an element 360. The problem is that it only executes the first time and i don't know why!

jQuery.fn.circularFun = function() {
            this.stop().animate(
                {rotation: 360},
                {
                  duration: 500,
                  step: function(now, fx) {
                    $(this).css({"transform": "rotate("+now+"deg)"});
                  }
                }
            );
        }

Thanks!!

Jonathan Gimeno
  • 434
  • 5
  • 13

1 Answers1

3

After your first rotation, it will already have been rotated to 360. You need to set it to 0 after you're finished.

David Hedlund
  • 128,221
  • 31
  • 203
  • 222