123

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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              mixin content_1()
  h3 Lorem ipsum dolor sit amet
  p Lorem ipsum dolor sit amet consectetur, adipisicing elit. Blanditiis explicabo porro, voluptatum laborum cumque molestiae quibusdam accusamus sed, quam sint ducimus libero distinctio? Dolore laborum, quos dolorem recusandae deleniti quasi.

#app.Wrap
  h1 Accordion

  .Accordion
    expander(title='base expander:rightToLeft')
      +content_1()
    expander(title='expander animation:leftToRight', animation='leftToRight')
      +content_1()
    expander(title='expander animation:bounceIn', animation='bounceIn')
      +content_1()
    expander(title='expander animation:bottomToTop', animation='bottomToTop')
      +content_1()
            
          
!
            
              .beforeBorder
  position relative
  &:before {
      transition: opacity .1s linear, transform .5s ease-in-out;
      position: absolute;
      border-bottom: 1px solid currentColor;
      content: '';
      width: 100%;
      left: 0;
      bottom: -1px;
  }
  &:not(:hover)::before {
      transform: scaleX(0);
      opacity: 0;
  }


.Accordion
  background: #fff;
  box-shadow: 0 1px 12px 1PX rgba(0,0,0,0.25);
  overflow: hidden;  
  

.Expander
  &__trigger
    cursor pointer
    padding .7rem .5rem
    border-bottom 1px solid #efefef

    &:hover
      color #477dca
    &.active
      //color #777
      border-bottom-color #477dca

    &-Icon
      transition transform 0.2s cubic-bezier(0.23, 1, 0.32, 1)
      &.open
        stroke tomato
        transform rotate(180deg)

  &__body
    padding 1rem 1.5rem
    background #eff0f2 //#dee2e6 //#f1f1f1


.rightToLeft-enter-active
  animation rightToLeft .5s;
.rightToLeft-leave-active
  animation rightToLeft .5s reverse
@keyframes rightToLeft
  0%
    transform: translateX(100vw)
  50%
    transform: translateX(-2em)
  100%
    transform: translateX(0)


.leftToRight-enter-active
  animation leftToRight .5s;
.leftToRight-leave-active
  animation leftToRight .5s reverse
@keyframes leftToRight
  0%
    transform: translateX(-100vw)
  50%
    transform: translateX(2em)
  100%
    transform: translateX(0)


.bounceIn-enter-active
  animation bounceIn .3s;
.bounceIn-leave-active
  animation bottomToTop .2s reverse
@keyframes bounceIn {
  from,
  20%,
  40%,
  60%,
  80%,
  to {
    animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
  }
  0% {
    opacity: 0;
    transform: scale3d(0.3, 0.3, 0.3);
  }
  20% {
    transform: scale3d(1.1, 1.1, 1.1);
  }
  40% {
    transform: scale3d(0.9, 0.9, 0.9);
  }
  60% {
    opacity: 1;
    transform: scale3d(1.03, 1.03, 1.03);
  }
  80% {
    transform: scale3d(0.97, 0.97, 0.97);
  }
  to {
    opacity: 1;
    transform: scale3d(1, 1, 1);
  }
}

.bottomToTop-enter-active
  animation bottomToTop .5s forwards;
.bottomToTop-leave-active
  animation bottomToTop .5s reverse
@keyframes bottomToTop
  0%
    opacity 0
    transform: translateY(100%)
  100%
    transform: translateY(0)
            
          
!
            
              Vue.component("Expander", {
  template: `
<div class="Expander">
    <div class="Expander__trigger" 
      @click="open=!open" 
      :class="open?'active':'beforeBorder'">
        <svg 
          class="Expander__trigger-Icon" 
          :class="{open:open}" 
          width="40" height="12" 
          stroke="cornflowerblue">
            <polyline points="12,2 20,10 28,2" stroke-width="3" fill="none"></polyline>
        </svg>
        {{ title }}
    </div>
    <transition :name="animation">
        <div class="Expander__body" v-show="open">
            <slot></slot>
        </div>
    </transition>
</div>
  `,
  props: {
    title: {
      type: String,
      default: 'title'
    },
    animation: {
      type: String,
      default: 'rightToLeft'
      // validator: prop => ['leftToRight', 'bounceIn', 'bottomToTop'].includes(prop)
    }
  },
  data() {
    return {
      open: false
    }
  }
})


const vm = new Vue({
  el: "#app",
  data: {
  },
  computed: {
  },
  methods: {
  },
  mounted() {
  }
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console