LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code
CSS
html {
  box-sizing: border-box;
}

*, *:before, *:after {
  box-sizing: inherit;
  margin: 0;
  padding: 0;
  list-style: none;
  outline: none;
  border: none;
  appearance: none;
  background-color: transparent;
}

body {
  height: 100vh;
  font-family: 'Open Sans', sans-serif;
  font-weight: 400;
  font-size: 1.1em;
  background-color: #fefefe;
}

.container {
  margin: 50px auto 0 auto;
  text-align: center;
  position: relative;
}

.modal {
  position: fixed;
  top: 0;
  left: 50%;
  width: 420px;
  z-index: 5;
  visibility: hidden;
  backface-visibility: hidden;
  -webkit-transform: translateX(-50%) translateY(-100%);
  -moz-transform: translateX(-50%) translateY(-100%);
  -ms-transform: translateX(-50%) translateY(-100%);
  -o-transform: translateX(-50%) translateY(-100%);
  transform: translateX(-50%) translateY(-100%);
  -webkit-transition: all 0.4s ease;
  -moz-transition: all 0.4s ease;
  -ms-transition: all 0.4s ease;
  -o-transition: all 0.4s ease;
  transition: all 0.4s ease;
}

.modal-content {
  padding: 20px;
  text-align: left;
  background-color: #fff;
}
.modal-content h2 {
  font-weight: 600;
}
.modal-content h2, .modal-content p {
  margin: 10px auto;
  max-width: 90%;
  line-height: 140%;
}

.modal-visible {
  visibility: visible;
  -webkit-transform: translateX(-50%) translateY(0%);
  -moz-transform: translateX(-50%) translateY(0%);
  -ms-transform: translateX(-50%) translateY(0%);
  -o-transform: translateX(-50%) translateY(0%);
  transform: translateX(-50%) translateY(0%);
  -webkit-transition: all 0.3s ease;
  -moz-transition: all 0.3s ease;
  -ms-transition: all 0.3s ease;
  -o-transition: all 0.3s ease;
  transition: all 0.3s ease;
}

button.modal-trigger, button.modal-close {
  cursor: pointer;
  font-family: 'Lato', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  line-height: 1.1em;
  color: #7fadf2;
  border: 4px solid #96bcf4;
  border-radius: 100px;
  background-color: #fff;
}

.modal-trigger {
  padding: 10px 20px 10px 20px;
  font-size: 1.5em;
  -webkit-transition: all 0.2s ease;
  -moz-transition: all 0.2s ease;
  -ms-transition: all 0.2s ease;
  -o-transition: all 0.2s ease;
  transition: all 0.2s ease;
}
.modal-trigger:active {
  margin: 2px 0 0 0;
  -webkit-transition: all 0.2s ease;
  -moz-transition: all 0.2s ease;
  -ms-transition: all 0.2s ease;
  -o-transition: all 0.2s ease;
  transition: all 0.2s ease;
}

button.modal-close {
  margin: 20px auto 0 auto;
  padding: 9px 20px 10px 20px;
  display: block;
  font-size: 1em;
  border: 3px solid #96bcf4;
  box-shadow: 0 0 0 0 transparent;
}
button.modal-close:hover {
  color: #fff;
  border: 3px solid #7fadf2;
  background-color: #7fadf2;
}

.modal-overlay {
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  position: absolute;
  z-index: 1;
  visibility: hidden;
  opacity: 0;
  background-color: rgba(127, 173, 242, 0.4);
  -webkit-transition: all 0.4s ease;
  -moz-transition: all 0.4s ease;
  -ms-transition: all 0.4s ease;
  -o-transition: all 0.4s ease;
  transition: all 0.4s ease;
}

.overlay-visible {
  visibility: visible;
  opacity: 1;
  -webkit-transition: all 0.4s ease;
  -moz-transition: all 0.4s ease;
  -ms-transition: all 0.4s ease;
  -o-transition: all 0.4s ease;
  transition: all 0.4s ease;
}
JS
jQuery(document).ready(function() {
  var $modal = $('.modal');
  var $modalTrigger = $('.modal-trigger');
  var $modalClose = $('.modal-close');
  var $overlay = $('.modal-overlay');

  $modalTrigger.on('click', function(event) {
    $overlay.addClass('overlay-visible');
    $modal.addClass('modal-visible');
  });

  // Closes modal on 'dismiss me' button click
  $modalClose.on('click', function(event) {
    $overlay.removeClass('overlay-visible');
    $modal.removeClass('modal-visible');
  });

  // Closes modal on overlay click
  $overlay.on('click', function(event) {
    if ($(event.target).is($overlay) || $(event.target).is($modalClose)) {
      $overlay.removeClass('overlay-visible');
      $modal.removeClass('modal-visible');
    }
  });

  // Closes modal on esc
  $(document).keyup(function(event) {
    if (event.which == '27') {
      $overlay.removeClass('overlay-visible');
      $modal.removeClass('modal-visible');
    }
  });
});
Term
Wed, 12/27/2017 - 07:01

Related Codes

Pen ID
Pen ID
Pen ID
Square Adv