LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code

Responsive Popup

Click on the button below to view the responsive popup.

CSS
html, body {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  position: relative;
}

body {
  background-color: #E3E3E3;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  margin: auto;
  height: 240px;
  text-align: center;
}
body .container {
  max-width: 400px;
  margin: 0 auto;
  padding: 30px;
  text-align: center;
  background: white;
  border-radius: 10px;
  border: 5px solid #9AD3DE;
  box-sizing: border-box;
}

h1, p, h2, button {
  font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
  font-weight: 100;
  letter-spacing: 0.5px;
}

h1 {
  font-size: 40px;
  text-align: center;
  color: #666666;
  margin: 0 0 30px 0;
}

h2 {
  font-size: 34px;
  text-align: center;
  color: #666666;
  margin: 0 0 30px 0;
}

p {
  color: #666666;
  margin: 30px auto;
  text-align: center;
  font-size: 16px;
}

button {
  background: #89BDD3;
  border: 0;
  border-radius: 4px;
  padding: 7px 15px;
  font-size: 16px;
  color: #FFFFFF;
  cursor: pointer;
}
button:focus {
  outline: none;
}
button:hover {
  background: #aed2e1;
}

.popup {
  background: rgba(100, 100, 100, 0.6);
  position: fixed;
  display: none;
  z-index: 5000;
  height: 100%;
  width: 100%;
  left: 0;
  top: 0;
}
.popup > div {
  border-radius: 10px;
  position: fixed;
  background: #FFFFFF;
  box-shadow: 0px 0px 15px 0px rgba(0, 0, 0, 0.3);
  padding: 30px 15px;
  /* Width of popup can be changed */
  width: 70%;
  max-width: 600px;
  z-index: 5001;
  -moz-transform: translate(-50%, -50%);
  -ms-transform: translate(-50%, -50%);
  -webkit-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
  left: 50%;
  top: 50%;
  text-align: center;
  border: 5px solid #9AD3DE;
}
JS
function popupOpenClose(popup) {
	
	/* Add div inside popup for layout if one doesn't exist */
	if ($(".wrapper").length == 0){
		$(popup).wrapInner("
"); } /* Open popup */ $(popup).show(); /* Close popup if user clicks on background */ $(popup).click(function(e) { if ( e.target == this ) { if ($(popup).is(':visible')) { $(popup).hide(); } } }); /* Close popup and remove errors if user clicks on cancel or close buttons */ $(popup).find("button[name=close]").on("click", function() { if ($(".formElementError").is(':visible')) { $(".formElementError").remove(); } $(popup).hide(); }); } $(document).ready(function () { $("[data-js=open]").on("click", function() { popupOpenClose($(".popup")); }); });
Host Instantly Drag and Drop Website Builder

 

Description

Responsive pop-up for desktop, tablet and mobile that positions itself in the center of the page/screen.
Term
Mon, 11/27/2017 - 21:35

Related Codes

Pen ID
Pen ID
Pen ID