Created
June 15, 2015 12:18
-
-
Save mgiulio/dff8877d282f305edf23 to your computer and use it in GitHub Desktop.
Scripting CSS style sheets...
This file contains 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
function installCSS() { | |
var styleEl = document.createElement('style'); | |
styleEl.id = "inline-editor-css"; | |
document.head.appendChild(styleEl); | |
var sheet = styleEl.sheet; | |
var rules = sheet.rules; | |
sheet.insertRule('.editor { width: 100%; position: relative; display: none; }', rules.length); | |
sheet.insertRule('.editor textarea { width: 100%; display: block; }', rules.length); | |
sheet.insertRule('.editor .button.ok { position: absolute; left: 0; top: 100%; }', rules.length); | |
sheet.insertRule('.editor.visible { display: inline-block; }', rules.length); | |
installCSS = function() {}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment