<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge; chrome=1" />
<title>Lock content</title>
<style type="text/css">
* {
margin: 0px;
padding: 0px;
}
#locker {
display: none;
height: 250px;
width: 400px;
display: none;
padding: 5px;
background-color: #eeffee;
}
#locker ul {
margin-left: 30px;
}
#overlay {
background: rgba(0,0,0,0.3);
display: none;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 99998;
}
</style>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.0.min.js"></script>
</head>
<body>
<script type="text/javascript">
jQuery.fn.center = function() {
this.css("position", "absolute");
this.css("top", Math.max(0, (($(window).height() - $(this).outerHeight()) / 2) + $(window).scrollTop()) + "px");
this.css("left", Math.max(0, (($(window).width() - $(this).outerWidth()) / 2) + $(window).scrollLeft()) + "px");
return this;
}
$(document).ready(function() {
$('#locker').show().center().css('z-index', '99999');
$('#overlay').fadeIn(300);
$('#locker a').click(function() {
$('#locker').hide();
$('#overlay').fadeOut();
});
});
</script>
<div>
<header>
<h1>Content Locker test</h1>
</header>
<div>
Site content...
</div>
<div id="locker">
This is the content locker
<ul>
<li>
<a href="#">Link 1</a>
</li>
<li>
<a href="#">Link 2</a>
</li>
<li>
<a href="#">Link 3</a>
</li>
</ul>
</div>
</div>
<div id="overlay"></div>
</body>
</html>