Skip to content

Instantly share code, notes, and snippets.

@tallykatt
Forked from mbobin/overlay.js
Created July 24, 2016 23:29
Show Gist options
  • Save tallykatt/116f201d1d4d4e16f3c7227c1a79d829 to your computer and use it in GitHub Desktop.
Save tallykatt/116f201d1d4d4e16f3c7227c1a79d829 to your computer and use it in GitHub Desktop.
bookmarklet - adds a black div as overlay
// add layer
javascript:(
function() {
var div = document.createElement('div');
var w = window.innerWidth;
var h = window.innerHeight;
div.setAttribute("class", "black-overlay");
div.setAttribute("style", "position: fixed; top: 0px; left:0px; width: "+w+"px; height: "+h+"px; background-color: rgba(0,0,0,0.3); pointer-events: none; z-index: 4294967296");
document.body.appendChild(div);
}
)();
// remove layer
javascript:(
function() {
o = document.getElementsByClassName('black-overlay');
document.body.removeChild(o[0]);
}
)();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment