Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="btn-container" data-toggle="modal" data-target="myModal">
  <h1>Main title here</h1>
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos soluta quam fuga magnam maiores dolor ratione ex. Iste provident, vitae doloremque, tempora quis soluta ipsum vero ullam, eos alias deleniti!</p>
  <button class="btn" data-toggle="trigger">Read more</button>
</div>

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h2>My sliding panel</h2>
      </div>
      <div class="modal-body">
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Architecto sapiente ipsam, consequuntur ipsum esse repudiandae iusto! Commodi eveniet harum accusamus possimus voluptatum voluptates minima modi fugit, odio laborum qui voluptatem.</p>
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Vitae eos molestias pariatur minus nisi optio, unde quisquam consequuntur. Officia provident aliquam, autem dicta libero ut minima illum impedit mollitia adipisci? Lorem ipsum dolor sit amet, consectetur adipisicing elit. Repudiandae voluptas maiores soluta ducimus adipisci distinctio labore deserunt laborum.</p>
      </div>
      <div class="modal-footer">
        <a id="close-trigger" tabindex="-1" data-dismiss="modal">
          <span class="first">Close</span>
          <span class="second"></span>
        </a>
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                @import "bourbon";

// VARIABLES //

// Colors
$dark: #3E4477;
$black: #212121;
$purple: #C86BD9;
$light: #d0d3d9;

// Font
$mainFont: 'Nunito', sans-serif;

// MIXIN //

@mixin valign {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

body {
  background: $dark;
  color: $light;
  font-family: $mainFont;
  font-weight: 300;
  overflow: hidden;
}

h1, h2 {
  color: $purple;
}

h1 {
  font-size:32px;
}

h2 {
  font-size: 28px;
}

p {
  margin: 2em 0;
}

.btn-container {
  @include valign;
  text-align: center;
  margin: 0 10%;
  padding: 5em;
  @include transition(all .3s);
  
  &.zAnimate {
    transform: perspective(1000px) translateZ(-150px);
    opacity: 0.4;
  }
}

.btn {
  background-color: transparent;
  border: 1px solid $purple;
  color: $purple;
  padding: 0.75em 2em;
  cursor: pointer;
  border-radius: 10px;
  text-transform: uppercase;
  @include transition(border-radius .2s, color 1s, border 1s, background-color 1s);
  
  &:hover, &:focus, &:active {
    outline: 0 !important;
    color: $purple;
  }
  
  &:hover, &:focus {
    border-radius: 0;
    color: $light;
    border: 1px solid $light;
    background-color: lighten($dark, 8%);
  }
}

.modal {
  background-color: rgba(0, 0, 0, .75);
  position: absolute;
  top: -100%;
  outline: 0 !important;
  text-align: center;
  padding: 5em;
  @include transition(top 0.3s);
  box-shadow: 0 0 10px rgba(0,0,0, 0.55);
  
  &.move-bottom {
    top:0;
  }
}

#close-trigger {
  font: 0/0 a;
  text-shadow: none;
  color: transparent;
  position: relative;
  display: inline-block;
  text-align: center;
  width: 25px;
  height: 22px;
  cursor: pointer;
  
  &:focus {
    outline: 0;
  }
  
  &:hover {
      span {
        background-color: $light;
        &.first {
        @include transform(rotate(-45deg) translateY(0));
        }
        &.second {
        @include transform(rotate(45deg) translateY(0)); 
        }
      }
    }
  
  span {
    position: absolute;
    top:10px;
    display: block;
    background-color: $purple;
    width: 100%;
    height: 2px;
    pointer-events: none;
    @include transition(transform .3s, background-color .2s);
    
    &.first {
        @include transform(rotate(45deg) translateY(0));
    }
    &.second {
        @include transform(rotate(-45deg) translateY(0)); 
    }
  }
}
              
            
!

JS

              
                var myTrigger = $('[data-toggle="trigger"]');

myTrigger.each(function() {
  var $this = $(this),
      main = $this.closest('[data-toggle="modal"]'),
      modalId = main.data('target'),
      modal = $('#' + modalId),
      close = modal.find('[data-dismiss="modal"]');
  
  $this.on('click', function() {
    modal.addClass('move-bottom');
    main.addClass('zAnimate');
    close.addClass('is-triggered');
  });
  
  close.on('click', function() {
    modal.removeClass('move-bottom');
    main.removeClass('zAnimate');
  });
});



    
              
            
!
999px

Console