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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


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


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.


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.


                <div id="some-list" class="q" droppable="true" v-on="dragover:dragover, drop:drop">
  <div v-repeat="items" draggable="true" v-on="dragstart:dragstart, dragend:dragend, dragover:dragover, dragenter:dragenter">{{text}}</div>
  <div id="placeholder">placeholder</div>



  background-color #eee  
.q div
  width 200px
  height 50px
  border solid 1px #ccc
  box-shadow 0 1px 2px 0px #888
  background-color #f8f8f8
  margin 5px  
  display inline-block
  position absolute
  transition top 400ms
    opacity 0.2



new Vue {
    el: '#some-list'
    data: {
       items: [1 to 5].map -> {text: "Item-#{it}", qqq:it}
       _dragElem: null
       _insertIndex: null
       _placeholder: document.getElementById 'placeholder'
    methods: {
       reorder: !->
         sty_elem = document.createElement('style');
         document.head.appendChild sty_elem
         sty_elem.appendChild (document.createTextNode '')
         s = sty_elem.sheet
         for i from 0 to this.items.length
           e = i
           if this._dragElem?
             sourceIndex = this._dragElem.$index
             --e if sourceIndex < e
             #console.log i, e
           rule = ".q div:nth-child(#{i+1}) {top:#{e*50}px }"
           s.insertRule rule, s.cssRules.length

       dragstart: (ev) !->
           this._dragElem = ev.targetVM
           this._dragNode =
           st =
           Vue.nextTick !->
             st.opacity = 0
             st.height = 0
           this.$el.insertBefore this._placeholder,           
           #ev.preventDefault! # <- should not do this
       dragend: (ev) !->
           #console.log \dragend
           this.$el.removeChild this._placeholder
  = 1
  = '50px'

           this._dragNode = null
           this._dragElem = null
       drop: (ev) !->
           #console.log \drop
           insertIndex = this._insertIndex
           sourceIndex = this._dragElem.$index
           return if sourceIndex == insertIndex

           removed = this.items.splice sourceIndex, 1
           this.items.splice insertIndex, 0, removed[0]
           this.dragend ev
       dragover: (ev) !->
           #console.log \over         
           return true
       dragenter:  (ev) !->
           sourceIndex = this._dragElem.$index
           insertIndex = ev.targetVM.$index
           this._insertIndex = insertIndex

           # FIXME
           posElem = if sourceIndex < insertIndex then else
           this.$el.insertBefore this._placeholder, posElem.nextSibling
           return true
    created: !->