1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[help]need script in looks like

Discussion in 'HTML & JavaScript' started by maxthon, Dec 21, 2009.

  1. maxthon

    maxthon Newbie

    Joined:
    Sep 15, 2009
    Messages:
    30
    Likes Received:
    4
    hi i'm need script before we entering website we have click some ads before entering
     
    Last edited: Dec 22, 2009
  2. inviz

    inviz Newbie

    Joined:
    Jun 15, 2010
    Messages:
    45
    Likes Received:
    5
    Something quick i came up with

    Code:
    <!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>
    
    Just change the contents of <div id="locker"> </div> to suit your needs.. You have to edit the script a little, if your ads isnt regular links (e.g. javascript)..