Skip to content

Instantly share code, notes, and snippets.

@UnforeseenOcean
Created July 23, 2019 12:27
Show Gist options
  • Save UnforeseenOcean/8ec88d2fe6766c265f7a9cf7549fd5d9 to your computer and use it in GitHub Desktop.
Save UnforeseenOcean/8ec88d2fe6766c265f7a9cf7549fd5d9 to your computer and use it in GitHub Desktop.
Inject CSS into page and apply it to ALL divs
var anim="@keyframes spin{0%{transform:rotate(0deg);}100%{transform:rotate(360deg);}}",head=document.head||document.getElementsByTagName('head')[0],style=document.createElement('style');head.appendChild(style);var e=document.getElementsByTagName('div');style.type='text/css';if(style.styleSheet){style.styleSheet.cssText = anim;}else{style.appendChild(document.createTextNode(anim));}for(var i=0;i<e.length;i++){e[i].setAttribute("style","animation:spin 0.5s infinite linear;")};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment