Last active
August 29, 2015 14:21
-
-
Save andrewplummer/53ce9bf6fc895768210b to your computer and use it in GitHub Desktop.
Spin all da things
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
var style = document.createElement('style'); | |
style.innerHTML = [ | |
'@-moz-keyframes spin {', | |
'from { -moz-transform: rotate(0deg); }', | |
'to { -moz-transform: rotate(360deg); }', | |
'}', | |
'@-webkit-keyframes spin {', | |
'from { -webkit-transform: rotate(0deg); }', | |
'to { -webkit-transform: rotate(360deg); }', | |
'}', | |
'@keyframes spin {', | |
'from {transform:rotate(0deg);}', | |
'to {transform:rotate(360deg);}', | |
'}' | |
].join(''); | |
document.querySelector('head').appendChild(style); | |
Array.prototype.slice.call(document.querySelectorAll('body a')).forEach(function(el) { | |
var s = el.style; | |
var anim = 'spin 1s infinite linear' | |
if (s.webkitAnimation != null) { | |
s.webkitAnimation = anim; | |
} else if (s.mozAnimation != null) { | |
s.mozAnimation = anim; | |
} else if (s.animation != null) { | |
s.animation = anim; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment