Created
November 22, 2011 19:08
-
-
Save frne/1386581 to your computer and use it in GitHub Desktop.
jsOverlay - A function to overlay a webpage
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
#jsOverlay | |
{ | |
background-color: #ffffff; | |
opacity: 0.7; | |
filter: alpha(opacity=70); | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 100%; | |
height: 100%; | |
z-index: 10; | |
} |
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 to overlay a webpage | |
* | |
* A Simple overlay function to block page access (modal page overlay) | |
* | |
* Usage: | |
* jsOverlay(true); // overlay's page | |
* jsOverlay(false); // hides the overlay | |
* | |
* @author Frank Neff <[email protected]> | |
* @licence LGPL v3 http://www.opensource.org/licenses/LGPL-3.0 | |
* @since 2011/11/22 | |
*/ | |
function jsOverlay( action ) { | |
var overlaySelector = document.getElementById( "jsOverlay" ), | |
overlayDiv = false; | |
if( action === false ) { | |
overlaySelector.style.display = "none"; | |
} else { | |
if( overlaySelector === null ) { | |
overlayDiv = document.createElement( "div" ) ; | |
overlayDiv.id = "jsOverlay"; | |
document.getElementsByTagName( "body" )[0].appendChild( overlayDiv ); | |
} else { | |
overlaySelector.style.display = "block"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment