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

              
                <h1>Fork this demo and add your code</h1>
<h3>div will change color via onRelease  </h3>
<div id="demo">
  <div class="box">drag me</div>
</div>



  
  
  
  
  
  
  
  
  
              
            
!

CSS

              
                body{
 font-family:sans-serif;
  background:#1d1d1d;
  color:white;
}
h1 {
  margin: 5px 0;
}

.box {
	background-color: #91e600;
	text-align: center;
	font-family: Asap, Avenir, Arial, sans-serif;
	width: 196px;
	height: 100px;
	line-height: 100px;
	color: black;
	position: absolute;
	border-radius: 10px;
}


#demo {
  width:800px;
  height:400px;
  background-color:black;
  position:relative;
  margin-top:10px;
}

label {
  font-size:20px;
}


              
            
!

JS

              
                var hue = 0;
Draggable.create(".box", {
		bounds:"#demo",
  //allowNativeTouchScrolling:false,
		type:"x",
    onRelease:function() {
      TweenLite.set(this.target, {backgroundColor:"hsla("+ (hue+=60) + ", 80%, 50%, 1)"})
    }
		}
)



/* This Pen Loads the Following
  jQuery: latest version
  TweenMax: latest version
    -TweenLite
    -TweenMax
    -TimelineLite
    -TimelineMax
    -CSSPlugin
    -BezierPlugin
    -DirectionalRotationPlugin
    -AttrPlugin
    -RoundPropsPlugin
    -EasePack
  Draggable
    
  ** Bonus Plugins **
    -ThrowPropsPlugin
    
  Please use the minimal amount of code
  possible to recreate the problem you
  are experiencing.
  
*/




              
            
!
999px

Console