Created
June 16, 2013 17:14
-
-
Save mojaray2k/5792703 to your computer and use it in GitHub Desktop.
Create a Background overlay in javascript
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
//overlay.js | |
var myOverlay = document.createElement('div'); | |
myOverlay.id = "overlay"; | |
document.body.appendChild(myOverlay); | |
//Setup Overlay Styles | |
myOverlay.style.position = 'absolute'; | |
myOverlay.style.top = 0; | |
myOverlay.style.backgroundColor = 'rgb(0,0,0,0.7)'; | |
myOverlay.style.cursor = "pointer"; | |
//Resize and position overlay | |
myOverlay.style.width = window.innerWidth + "px"; | |
myOverlay.style.height = window.innerHeight + "px"; | |
myOverlay.style.top = window.pageYOffset + "px"; | |
myOverlay.style.left = window.pageXOffest + "px"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment