cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <!--- Modal Triggers --->
<a class="btn btn-primary js-modal-trigger" data-modal="lil-bit-content">Show me the modal with a teenie bit of content!</a>

<a class="btn btn-info js-modal-trigger" data-modal="lots-of-content">Show me the modal with a lot of content!</a>

<!--- Modal Stuffs --->
<div class="modal-overlay"></div>


<section id="lil-bit-content" class="modal">
    <header class="modal-header">
      <h1>I am a modal</h1>
    </header>
    <div class="modal-body">
     <p>Cupcake ipsum dolor sit amet icing unerdwear.com topping.</p>
   </div>
  <footer class="modal-footer">
    <a class="btn btn-primary js-close-modal-trigger">Close Modal</a>
  </footer>
</section>

<section id="lots-of-content" class="modal">
    <header class="modal-header">
      <h1>I am a modal</h1>
    </header>
    <div class="modal-body">
     <p>Cupcake ipsum dolor sit amet icing unerdwear.com topping. I love muffin icing bonbon halvah. Jelly halvah macaroon I love pastry bonbon. Cookie carrot cake sweet roll. Gingerbread biscuit applicake soufflé liquorice candy canes tart jujubes muffin. Tiramisu I love biscuit dessert. Jelly tootsie roll candy canes marshmallow biscuit fruitcake. I love chocolate bar danish. I love marzipan pastry cupcake topping cookie wafer. Ice cream gingerbread topping donut soufflé. Jelly beans chocolate bar gummies pudding chocolate bar applicake cheesecake chocolate cake. Jelly beans ice cream sweet candy canes. Apple pie cake I love apple pie. Sweet roll I love toffee tart.</p>
     <p>Cupcake ipsum dolor sit amet icing unerdwear.com topping. I love muffin icing bonbon halvah. Jelly halvah macaroon I love pastry bonbon. Cookie carrot cake sweet roll. Gingerbread biscuit applicake soufflé liquorice candy canes tart jujubes muffin. Tiramisu I love biscuit dessert. Jelly tootsie roll candy canes marshmallow biscuit fruitcake. I love chocolate bar danish. I love marzipan pastry cupcake topping cookie wafer. Ice cream gingerbread topping donut soufflé. Jelly beans chocolate bar gummies pudding chocolate bar applicake cheesecake chocolate cake. Jelly beans ice cream sweet candy canes. Apple pie cake I love apple pie. Sweet roll I love toffee tart.</p>
     <p>Cupcake ipsum dolor sit amet icing unerdwear.com topping. I love muffin icing bonbon halvah. Jelly halvah macaroon I love pastry bonbon. Cookie carrot cake sweet roll. Gingerbread biscuit applicake soufflé liquorice candy canes tart jujubes muffin. Tiramisu I love biscuit dessert. Jelly tootsie roll candy canes marshmallow biscuit fruitcake. I love chocolate bar danish. I love marzipan pastry cupcake topping cookie wafer. Ice cream gingerbread topping donut soufflé. Jelly beans chocolate bar gummies pudding chocolate bar applicake cheesecake chocolate cake. Jelly beans ice cream sweet candy canes. Apple pie cake I love apple pie. Sweet roll I love toffee tart.</p>
     <p>Cupcake ipsum dolor sit amet icing unerdwear.com topping. I love muffin icing bonbon halvah. Jelly halvah macaroon I love pastry bonbon. Cookie carrot cake sweet roll. Gingerbread biscuit applicake soufflé liquorice candy canes tart jujubes muffin. Tiramisu I love biscuit dessert. Jelly tootsie roll candy canes marshmallow biscuit fruitcake. I love chocolate bar danish. I love marzipan pastry cupcake topping cookie wafer. Ice cream gingerbread topping donut soufflé. Jelly beans chocolate bar gummies pudding chocolate bar applicake cheesecake chocolate cake. Jelly beans ice cream sweet candy canes. Apple pie cake I love apple pie. Sweet roll I love toffee tart.</p>
   </div>
  <footer class="modal-footer">
    <a class="btn btn-primary js-close-modal-trigger">Close Modal</a>
  </footer>
</section>
            
          
!
            
              body {
  padding: 20px;
  z-index: 1000;
}

.modal {
  background-color: white;
  border-radius: 10px;
  display: none;
  max-height: calc(100% - 100px);
  position: fixed;
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
  transform: translate(-50%, -50%);
  z-index: 990;
  
  &.modal-is-visible {
    display: block;
    z-index: 1010;
  }
  
  h1 {
    margin: 0;
    padding: 0;
  }
  
  .modal-body {
    height: 100%;
    overflow: auto;
    overflow-y: scroll;
  }
  
} // .modal

.modal-overlay {
  background-color: transparentize(black, .5);
  display: none;
  position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
  z-index: 980;
  
  &.modal-is-visible {
    display: block;
    z-index: 1009;
  }
  
} // .modal-overlay
            
          
!
            
              # Simple Modal

$ ->
  $(document).on 'click', '.js-modal-trigger', (e) ->
    $this = $(this)
    whichModal = $this.attr("data-modal")

    # Adding Visible States for Modal
    $(".modal-overlay").addClass("modal-is-visible")
    $("#" + whichModal).addClass("modal-is-visible")

  $(document).on 'click', '.js-close-modal-trigger', (e) ->

    # Close All Modals
    $(".modal-overlay").removeClass("modal-is-visible")
    $(".modal").removeClass("modal-is-visible")

            
          
!
999px
Loading ..................

Console