Modal

<div class="modal">
    <div class="modal-inner has-shadow">
        <button data-modal-close class="modal-close">
    	<svg id="nav-trigger" class="nav-trigger" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="32">
	  		<path id="cross" d="M5.65 7.443L7.064 6.03l10.48 10.48-1.415 1.414zM5.644 16.509l3.931-3.932 1.414 1.415-3.931 3.931zM12.194 9.956l3.931-3.932L17.54 7.44l-3.931 3.931z"/>
		</svg>
	</button>
        <div class="modal-content"></div>
    </div>
</div>
  • Content:
    /* @modal */
    .modal-hider {
      display: none;
      position: absolute;
      left: -99999em;
    }
    
    .modal {
      display: none;
    
      @at-root body.modal-visible & {
        .modal-inner {
          transform: translate(-50%, -50%) scale(1) !important;
        }
      }
    
      &::before {
        content: none !important;
      }
    
      &-inner {
        transform: translate(-50%, -50%) !important;
        position: absolute !important;
        left: 50%;
        top: 50%;
      }
    }
    
    .vanilla-modal .modal {
      display: block;
      position: fixed;
      content: "";
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(#fff, 0.95);
      z-index: -1;
      opacity: 0;
      transition: opacity 0.2s, z-index 0s 0.2s;
      text-align: center;
      overflow: hidden;
      overflow-y: auto;
      white-space: nowrap;
      -webkit-overflow-scrolling: touch;
    }
    
    .vanilla-modal .modal > * {
      display: inline-block;
      white-space: normal;
      vertical-align: middle;
      text-align: left;
    }
    
    .vanilla-modal .modal:before {
      display: inline-block;
      overflow: hidden;
      width: 0;
      height: 100%;
      vertical-align: middle;
      content: "";
    }
    
    .vanilla-modal.modal-visible .modal {
      z-index: 99990;
      opacity: 1;
      transition: opacity 0.2s;
    }
    
    .modal-inner {
      @include poly-padding--large;
      padding-top: 50px !important;
      position: relative;
      overflow: hidden;
      width: 90%;
      max-width: 680px;
      overflow-x: hidden;
      overflow-y: auto;
      background: #fff;
      z-index: -1;
      opacity: 0;
      transform: scale(0);
      transition: opacity 0.2s, transform 0.2s, z-index 0s 0.2s;
      box-shadow: 18px 19px 50px 0 rgba(#000, 0.1);
    
      .modal-content {
        .cta {
          padding: 0.75em !important;
        }
      }
    }
    
    .modal-visible .modal-inner {
      z-index: 500;
      max-height: 70%;
      opacity: 1;
      transform: scale(1);
      transition: opacity 0.2s, transform 0.2s;
    }
    
    @media (max-width: 767px) {
      .modal-visible .modal-inner {
        max-height: 90% !important;
      }
    }
    
    .modal-close {
      position: absolute;
      z-index: 2;
      right: 0;
      top: 0;
      width: 50px;
      height: 50px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      text-align: center;
      background: #fff;
    
      svg {
        width: 25px;
        height: 25px;
        @include themify($themes) {
          fill: themed('ctaColor');
        }
      }
    }
    
  • URL: /components/raw/modal/_modal.scss
  • Filesystem Path: src/components/_support-blocks/_modal/_modal.scss
  • Size: 2.2 KB
  • Content:
    import VanillaModal from 'vanilla-modal'
    const modal = new VanillaModal({
      modal: '.modal',
      modalInner: '.modal-inner',
      modalContent: '.modal-content',
      open: '[data-modal-open]',
      close: '[data-modal-close]',
      page: 'body',
      loadClass: 'vanilla-modal',
      class: 'modal-visible',
      clickOutside: true,
      closeKeys: [27],
      transitions: true,
      onBeforeOpen: null,
      onBeforeClose: null,
      onOpen: null,
      onClose: null
    })
  • URL: /components/raw/modal/modal.js
  • Filesystem Path: src/components/_support-blocks/_modal/modal.js
  • Size: 430 Bytes