Rotate a div using javascript
To rotate a DIV we can add some CSS that, well, rotates the DIV using CSS transform rotate. To toggle the rotation we can keep a flag, a simple variable with a boolean value that tells us what way to rotate. var rotated = false; document.getElementById(‘button’).onclick = function() { var div = document.getElementById(‘div’), deg = … Read more