cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-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.

            
              <main>
  <transition name="button">
    <button @click="toggleModal()" v-show="!showModal"><i class="fa fa-2x fa-id-card-o"></i></button>
  </transition>
  
    <!--  The Modal -->
  <modal v-if="showModal" :flip-me="flipMe" @toggle="toggleModal()">
    <div slot="front-header">
      <b>Gimme the Keys</b>
    </div>
    <div slot="front-body">
      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Tenetur quia totam velit amet porro libero ab blanditiis fugiat repudiandae, aperiam, quod ut odit cumque eos modi doloremque laborum delectus commodi!
    </div>
    <div slot="front-footer">
      <button @click="flipModal()"><i class="fa fa-arrow-right"></i></button>
<!--       <button @click="toggleModal()">Done</button> -->
    </div>
    <div slot="back-header">
      <b>Flip You Fo Real!</b>
    </div>
    <div slot="back-body">
      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Reiciendis necessitatibus cumque, quaerat sunt, aliquam, officia ut delectus explicabo laborum distinctio totam tempore debitis. Error odio quidem cupiditate, harum, similique laboriosam.
    </div>
    <div slot="back-footer">
      <button @click="toggleModal()">Done</button>
      <button @click="flipModal()"><i class="fa fa-arrow-left"></i></button>
    </div>
  </modal>

</main>
            
          
!
            
              :root {
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  &__wrapper {
    position: relative;
    width: 65vmin;
    height: 35vmin;
    min-height: 15em;
    min-width: 20em;
    display: flex;
  }
  &__container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    color: #333;
    border-radius: .2em;
    box-shadow: 0 0 0 1px rgba(0,0,0,.2), 0 1em 2em -1em;
  }
  &__header {
    flex: none;
    display: flex;
    justify-content: space-between;
    padding: 1em;
  }
  &__body {
    flex: 1;
    padding: 1em;
    overflow: auto;
  }
  &__footer {
    flex: none;
    padding: 1em;
    > * {
      flex-direction: row-reverse;
      display: flex;
      justify-content: space-between;
    }
  }
  &__x {
    cursor: pointer;
    font-size: 2em;
    line-height: .5;
  }
}

.button-leave-active,
.modal-enter-active {
  transition: transform 500ms cubic-bezier(1, 0, 0.2, 1.5);
}
.modal-leave-active,
.button-enter-active {
  transition: transform 500ms cubic-bezier(1, -0.5, 0.2, 1);
}

.mask-enter-active, .mask-leave-active {
  transition: opacity 300ms linear;
}
.mask-enter, .mask-leave-to {
  opacity: 0;
}

.button-enter, .button-leave-to,
.modal-enter, .modal-leave-to {
  transform: scale(0);
}


// flipper
.flip-container {
  perspective: 900;
  &.flip-me .flipper {
    transform: rotateY(-180deg);
  }
}
.flipper {
  will-change: transform;
  transition: transform 1000ms cubic-bezier(1, -0.2, 0.2, 1.2);
  transform-style: preserve-3d;
  position: relative;
  transform: rotateY(0);
  .front,
  .back {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }
  .front {
    transform: rotateY(0deg);
  }
  .back {
    transform: rotateY(-180deg);
  }
}

// boring
[v-cloak] {
  display: none !important;
}

*, *::before, *::after {box-sizing: border-box;}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: sans-serif;
  background: #21c2f5; //#9ccf5e;
  color: #fff;
}

button {
  border: none;
  box-shadow: 0 0 0 2px rgba(0,0,0,.2) inset;
  padding: .7em 1em;
  border-radius: .35em;
  color: #fff;
  font: inherit;
  background: #333;
  cursor: pointer;
  outline: none;
  will-change: transform;
  transition: transform .2s ease-out;
  &:active {
    transform: scale(.9);
  }
}
            
          
!
            
              Vue.component('modal', {
  template: `
    <transition name="modal">
      <div class="modal flip-container" :class="{'flip-me': flipMe}">
        <div class="modal__wrapper flipper">
          <div class="modal__container front">
            <div class="modal__header">
              <slot name="front-header"></slot>
              <div class="modal__x" @click="$emit('toggle')">&times;</div>
            </div>
            <div class="modal__body">
              <slot name="front-body"></slot>
            </div>
            <div class="modal__footer">
              <slot name="front-footer"></slot>
            </div>
          </div>
          <div class="modal__container back">
            <div class="modal__header">
              <slot name="back-header"></slot>
              <div class="modal__x" @click="$emit('toggle')">&times;</div>
            </div>
            <div class="modal__body">
              <slot name="back-body"></slot>
            </div>
            <div class="modal__footer">
              <slot name="back-footer"></slot>
            </div>
          </div>
        </div>
      </div>
    </transition>
  `,
  props: [
    'flipMe'
  ]
})

new Vue({
  el: 'main',
  data: {
    showModal: true,
    flipMe: false
  },
  methods: {
    toggleModal: function() {
      this.showModal = !this.showModal
    },
    flipModal: function() {
      this.flipMe = !this.flipMe
    }
  }
})
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console