-
-
Save tallykatt/116f201d1d4d4e16f3c7227c1a79d829 to your computer and use it in GitHub Desktop.
bookmarklet - adds a black div as overlay
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
// 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