Pen Settings



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


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.


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.


<div id="box"></div>



                #box {
  position: absolute;
  width: 100px;
  height: 100px;
  background: green;


                // callbacks queueing via gsap animation.
// 1. add array of objects holding callbacks
// 2. check if there is anything add to queue, if so take first object and add it to timeline
// 3. run the timeline
// 4. if timeline finishes, start next function to take another element from queue
// 5. do that until there is nothing in queue
var tl = new TimelineMax();

var obj = {
  // first move first element from arr.move to arr.playing (currently playing) and run function next 
	add: function (arr) {
	next: function () {
// check if there is anything to process
		if ( arrays.playing.length ) {
      // and if timeline is playing
			if ( !tl.isActive() ) {
        // take first object from current queue 
				var callback = arrays.playing.shift();
				if ( callback ) {
 //$("#box"), 3, { y: "+=100"})
         // add that object to timeline
  // move #box 100px to right if someone calls 
	red: function () {
		var tt = new TimelineMax;
			.to($("#box"), 3, { x: "+=100"})
		return tt

 // same with this.magenta
	magenta: function () {
		var tt = new TimelineMax;
		tt.set($("#box"), { "backgroundColor": "#ff00ff" })
		return tt


// array holding objects each one may be added to queue
var arrays = {
	playing: [],
	move:    [ { fn: } , { fn: obj.magenta }]

	if ( e.which == 77 ) {
    // by pressing "m" add array of callbacks to queue processing