Skip to content

Instantly share code, notes, and snippets.

@stucox stucox/blackout.js
Created Mar 26, 2013

Embed
What would you like to do?
Blacks out / reveals the window. Useful as a bookmark (it toggles) — copy the minified version and stick `javascript:` in front of it.
(function () {
var cover = document.getElementById('__cover');
if(cover) {
document.body.removeChild(cover);
}
else {
cover = document.createElement('div');
cover.id = '__cover';
cover.setAttribute('style', 'background:#000;position:fixed;top:0;left:0;width:100%;height:100%;z-index:999999');
document.body.appendChild(cover);
}
}());
(function(){var e=document.getElementById("__cover");if(e){document.body.removeChild(e)}else{e=document.createElement("div");e.id="__cover";e.setAttribute("style","background:#000;position:fixed;top:0;left:0;width:100%;height:100%;z-index:999999");document.body.appendChild(e)}})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.