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 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.

Quick-add: + add another resource

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.

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.

            
              <div class="trigger" id="js-trigger" @click="execute">
  <p>Click to open the modal</p>
</div>
<div id="js-modal">
  <!-- 囲った要素にアニメーション設定のためのクラスを自動設定する -->
  <!-- name属性は接頭辞としてクラス名に使用される -->
  <transition name="modal">
    <div class="modal" v-show="opened" @click.self="close">
      <div class="modal__content">
        <p>This background layer will fade in and fade out</p>
      </div>
    </div>
  </transition>
</div>
            
          
!
            
              html, body, .trigger {
  margin: 0;
  width: 100%; height: 100%;
  position: relative;
}

.trigger > p {
  margin: 0;
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  font: bold 40px/1 sans-serif;
  opacity: .1;
  width: 600px;
}

.modal {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 10;
  background: rgba(0, 0, 0, .7);
  transform: translate3d(0, 0, 0);
}
/* 往路のアニメーション全体に対して設定をするためのクラス */
.modal-enter-active {transition: opacity .2s;}
/* 往路の開始状態を設定するためのクラス */
.modal-enter        {opacity: 0;}
/* 往路の終了状態を設定するためのクラス */
.modal-enter-to     {opacity: 1;}
/* 復路のアニメーション全体に対して設定をするためのクラス */
.modal-leave-active {transition: opacity .6s;}
/* 復路の開始状態を設定するためのクラス */
.modal-leave        {opacity: 1;}
/* 復路の終了状態を設定するためのクラス */
.modal-leave-to     {opacity: 0;}

.modal__content {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}
.modal__content > p {
  margin: 0;
  width: 600px;
  vertical-align: middle;
  text-align: center;
  font: bold 12px/100px sans-serif;
  letter-spacing: .1em;
  color: #aaa;
  background: #fff;
}


            
          
!
            
              var bus = new Vue();

new Vue({
  el: '#js-trigger',
  methods: {
    execute: function() {
      bus.$emit('click.trigger');
    }
  }
});

new Vue({
  el: '#js-modal',
  data: {
    opened: false
  },
  methods: {
    open: function() {
      this.opened = true;
    },
    close: function() {
      this.opened = false;
    }
  },
  created: function() {
    bus.$on('click.trigger', this.open);
  }
});
            
          
!
999px
Loading ..................

Console