Popup With Timer

In this example below you will see how to do a Popup With Timer with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by namimosha, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright namimosha ©
  • HTML
  • CSS
  • JavaScript
    <div class="popup-box" id="hid" style="display: block; visibility: hidden">
								<div class="transparent-layer"></div>
								<div class="popup-inner" style="">
				
									<div class="popup-msg">I'm a popup. Please use me as you like and I'm more efficient than iframe popup.</div>
									
								<button class="next-step-btn" onclick="location.href = 'www.facebook.com';">I'M A SASSY BUTON</button></div>
							</div>

/*Downloaded from https://www.codeseek.co/namimosha/popup-with-timer-wGJbPR */
    .popup-box{
	display: none;
	position: fixed;
	text-align: center;
	width: 100%;
	height: 100%;
	z-index: 10;
	top: 0;
	left: 0;
}

.popup-inner{
	max-width: 300px;
	min-height: 160px;
	background: white;
  border-radius: 25px;
	padding: 15px;
	margin: auto;
	top: 25%;
	position: relative;
}



.popup-msg{
	font-weight: bold;
	color: black;
	padding: 20px 20px 0 20px;
}

.next-step-btn{
	margin:20px auto 0;
background: linear-gradient(rgb(204,0,0), rgb(130,0,0));
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#015eab', endColorstr='#10276b');
	border: none !important;
	padding: 10px 40px !important;
	color: #fff !important;
	font-weight: bold;
	border-radius: 3px;
	cursor: pointer;
}

.transparent-layer{
	position: fixed;
	width: 100%;
	height: 100%;
	background: #000000;
	opacity: 0.3;
overflow: hidden;

}




/*Downloaded from https://www.codeseek.co/namimosha/popup-with-timer-wGJbPR */
    function showIt() {
  document.getElementById("hid").style.visibility = "visible";
}
setTimeout("showIt()", 3000); // after 3 seconds

Comments