Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                // Download the Free scene from https://www.mockupcloud.com/free/art-craft-stationery-branding-mockup

.main-bg(style='background: linear-gradient(to bottom left, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0) 15%, rgba(0, 0, 0, 0.25) 65%, rgba(0, 0, 0, 0.4) 100%), url(https://i.ibb.co/xFVvGfd/bg.jpg) no-repeat center center fixed;')
  // Document
  #document.drag.document-cont.obj-cont
    img.shadow.obj.document(src='https://i.ibb.co/F5VZPwk/document-ar-210-297-shadow.png')
    img.no-shadow.obj.document(src='https://i.ibb.co/r7j25DK/document-ar-210-297.png')
    
  // Ruler
  #ruler.ruler-cont.obj-cont
    img.shadow.obj.ruler(src='https://i.ibb.co/R4jwmvg/ruler-shadow.png')
    img.no-shadow.obj.ruler(src='https://i.ibb.co/tMfdkrZ/ruler.png')
    
  // Sharpener
  #sharpener.sharpener-cont.obj-cont
    img.shadow.obj.sharpener(src='https://i.ibb.co/0jCpxqX/sharpener-shadow.png')
    img.no-shadow.obj.sharpener(src='https://i.ibb.co/GpQFr5S/sharpener.png')
    
  // Pencil 1
  #pencil-1.pencil-cont.obj-cont
    img.shadow.obj.pencil(src='https://i.ibb.co/ySJx1Lm/pencil-shadow.png')
    img.no-shadow.obj.pencil(src='https://i.ibb.co/JmF6cKf/pencil.png')
    
  // Pencil 2
  #pencil-2.pencil-cont.obj-cont
    img.shadow.obj.pencil(src='https://i.ibb.co/ySJx1Lm/pencil-shadow.png')
    img.no-shadow.obj.pencil(src='https://i.ibb.co/JmF6cKf/pencil.png')
  
  // Clew
  #clew.clew-cont.obj-cont
    img.shadow.obj.clew(src='https://i.ibb.co/zSgm99f/clew-shadow.png')
    img.no-shadow.obj.clew(src='https://i.ibb.co/sKQFBDf/clew.png')
    
  // Clew Color
  #clew-color.clew-color-cont.obj-cont
    img.shadow.obj.clew-color(src='https://i.ibb.co/0jGwx9K/clew-color-shadow.png')
    img.no-shadow.obj.clew-color(src='https://i.ibb.co/m8Qn0jS/clew-color.png')
    
  // Brush
  #brush.brush-cont.obj-cont
    img.shadow.obj.brush(src='https://i.ibb.co/3d4FnLy/brush-shadow.png')
    img.no-shadow.obj.brush(src='https://i.ibb.co/pP8VXPt/brush.png')
    
  // Box
  #box.box-cont.obj-cont
    img.shadow.obj.box(src='https://i.ibb.co/kGH3dDj/box-shadow.png')
    img.no-shadow.obj.box(src='https://i.ibb.co/CzcSWVG/box.png')
    
  // Awl
  #awl.awl-cont.obj-cont
    img.shadow.obj.awl(src='https://i.ibb.co/jDjWSkD/awl-shadow.png')
    img.no-shadow.obj.awl(src='https://i.ibb.co/3k82J1f/awl.png')
    
  // Business Card 1
  #business-card-1.business-card-cont.obj-cont
    img.shadow.obj.business-card(src='https://i.ibb.co/ZTmVBkM/business-card-1-85-55-shadow.png')
    img.no-shadow.obj.business-card(src='https://i.ibb.co/2KgxMXC/business-card-1-85-55.png')
    
  // Business Card 2
  #business-card-2.business-card-cont.obj-cont
    img.shadow.obj.business-card(src='https://i.ibb.co/bL5CTJf/business-card-2-85-55-shadow.png')
    img.no-shadow.obj.business-card(src='https://i.ibb.co/9VXCKBb/business-card-2-85-55.png')
      
  // Envelope
  #envelope.envelope-cont.obj-cont
    img.shadow.obj.envelope(src='https://i.ibb.co/TqJRDDW/envelope-dl-110-220-shadow.png')
    img.no-shadow.obj.envelope(src='https://i.ibb.co/rdrL5Mn/envelope-dl-110-220.png')
    
    




   

    



              
            
!

CSS

              
                .main-bg
  width: 100%
  height: auto
  display: block
  min-height: 100%
  -webkit-background-size: auto !important
  -moz-background-size: auto !important
  -o-background-size: auto !important
  background-size: auto !important

  width: 100%
  height: auto

  position: fixed
  top: 0
  left: 0

.obj-cont
  position: relative
  
.obj
  border: 3px solid transparent

.resizing
  border: 3px solid transparentize(#000, 0.7)
  z-index: 9

.shadow
  mix-blend-mode: multiply

.no-shadow

.obj
  position: absolute

.drag:hover
  cursor: pointer

// Container and their positions
.document-cont
  left: 31%
  top: 9em
.ruler-cont
  left: 40%
  top: 40em
.sharpener-cont
  left: 58%
  top: 45em
#pencil-1
  left: 42%
  top: 37em
#pencil-2
  top: 35em
  left: 43%
.clew-cont
  left: 37%
  top: 0
.clew-color-cont
  left: 48%
  top: 5em
.brush-cont
  left: 53%
  top: 12em
.box-cont
  left: 54%
  top: 5em
.awl-cont 
  top: 8em
  left: 27%
#business-card-1
  top: 24em
  left: 27%
#business-card-2
  left: 34%
  top: 29em
.envelope-cont
  left: 54%
  top: 21.5em

// The width of the objects
.document
  width: 33%
.ruler
  width: 20%
.sharpener
  width: 4%
.clew
  width: 12%
.awl
  width: 12%
.clew-color
  width: 8%
.pencil
  width: 16%
.business-card
  width: 9%
.brush
  width: 13%
.box
  width: 16%
.envelope
  width: 20%

#mydiv
  position: absolute

.ui-draggable:hover
  cursor: pointer
  
.ui-draggable-dragging:active
  cursor: move
              
            
!

JS

              
                # things = '#glass-box, #tin-box, #paper-holder, #candle, #clock, #clew-color, #brush'
# Make the DIV element draggable:

dragElement = (elmnt) ->
  pos1 = 0
  pos2 = 0
  pos3 = 0
  pos4 = 0

  dragMouseDown = (e) ->
    e = e or window.event
    e.preventDefault()
    # get the mouse cursor position at startup:
    pos3 = e.clientX
    pos4 = e.clientY
    document.onmouseup = closeDragElement
    # call a function whenever the cursor moves:
    document.onmousemove = elementDrag
    return

  elementDrag = (e) ->
    e = e or window.event
    e.preventDefault()
    # calculate the new cursor position:
    pos1 = pos3 - (e.clientX)
    pos2 = pos4 - (e.clientY)
    pos3 = e.clientX
    pos4 = e.clientY
    # set the element's new position:
    elmnt.style.top = elmnt.offsetTop - pos2 + 'px'
    elmnt.style.left = elmnt.offsetLeft - pos1 + 'px'
    return

  closeDragElement = ->
    # stop moving when mouse button is released:
    document.onmouseup = null
    document.onmousemove = null
    return

  if document.getElementById(elmnt.id + 'header')
    # if present, the header is where you move the DIV from:
    document.getElementById(elmnt.id + 'header').onmousedown = dragMouseDown
  else
    # otherwise, move the DIV from anywhere inside the DIV:
    elmnt.onmousedown = dragMouseDown
  return

dragElement document.getElementById('document')
dragElement document.getElementById('ruler')
dragElement document.getElementById('sharpener')
dragElement document.getElementById('pencil-1')
dragElement document.getElementById('clew')
dragElement document.getElementById('clew-color')
dragElement document.getElementById('brush')
dragElement document.getElementById('box')
dragElement document.getElementById('awl')
dragElement document.getElementById('business-card-1')
dragElement document.getElementById('business-card-2')
dragElement document.getElementById('envelope')
dragElement document.getElementById('pencil-2')

# Resize button
(($) ->

  $.fn.imageResize = (options) ->
    settings = 
      width: 150
      height: 150
    options = $.extend(settings, options)
    @each ->
      $element = $(this)
      maxWidth = options.width
      maxHeight = options.height
      ratio = 0
      width = $element.width()
      height = $element.height()
      if width > maxWidth
        ratio = maxWidth / width
        $element.css 'width', maxWidth
        $element.css 'height', height * ratio
      if height > maxHeight
        ratio = maxHeight / height
        $element.css 'height', maxHeight
        $element.css 'width', width * ratio
      return

  return
) jQuery

a = 9
## Removing the resizing border while moving the object
$('.obj-cont').draggable
  start: ->
    $(this).find(".obj").css("z-index", a++);
    return
  drag: ->
    return
  stop: ->
    return
              
            
!
999px

Console