Last active
June 11, 2026 15:49
-
-
Save joewright/16ca1fa997f72922e4c4f3b6cac3e70b to your computer and use it in GitHub Desktop.
Click to spin JS.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // paste this in your browser's JS console for a better viewing and clicking experience | |
| var style = document.createElement('style'); | |
| style.innerHTML = '@keyframes spin {from {transform:rotate(0deg);} to {transform:rotate(359deg);} } @keyframes spinrev {from {transform:rotate(0deg);} to {transform:rotate(-359deg);} }'; | |
| document.head.appendChild(style); | |
| document.body.addEventListener('click', function(event) { | |
| event.preventDefault(); | |
| var target = event.target; | |
| var spin = (Math.random() < 0.5) ? 'spin' : 'spinrev'; | |
| target.style.animation = spin + ' 4s infinite linear'; | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment