1

I made an easy css keyframes animation like this

@keyframes spin {
  from {
    transform:rotate(0deg);
  }
  to {
    transform:rotate(360deg);
  }
}

In my HTML code, after an onclick I trigger document.getElementById(elementName).style.animation = "spin 1s";

This works exactly one time. On the second click nothing happens. Why? What do I have to change so the spin animation will be fired everytime at an onclick event?

I'm looking for a solution using in onclick where there animation will be fired every time. I fiddled with athe style.animation parameters but don't find any solution.

dd8zc
  • 11
  • 1

0 Answers0