I'm trying to make a box rotate through javascript/css3 rotate every time I click on it. It works, but only the first time I click on it. Each time after, I get the alert which means it's not a javascript error - but no animation.
Here is my simple page -
<script>
function rotate( box )
{
alert('start');
box.style.webkitTransform = 'rotate(360deg)';
}
</script>
<style>
#box{ height:100px; width:100px; border:1px solid red; -webkit-transition: -webkit-transform 1s ease-out; }
</style>
<div id='box' onclick='rotate(this);'></div>
I figured there needs to be something I need to put after the rotate() to tell it to go back to the beginning stage so that it can rotate 360 again.