Pen Settings

HTML

CSS

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

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

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.

HTML

              
                <div class="inliner"></div>
<div class="inlined">
  
  <!-- Start component -->
  <div class="progress-meter">
    <div class="track">
      <span class="progress"></span>
    </div>
    <ol class="progress-points" data-current="4">
      <li class="progress-point">
        <span class="label">Lorem ipsum</span>
      </li>
      <li class="progress-point">
        <span class="label">Aliquam tincidunt</span>
      </li>
      <li class="progress-point">
        <span class="label">Vestibulum auctor</span>
      </li>
      <li class="progress-point">
        <span class="label">Lorem ipsum</span>
      </li>
      <li class="progress-point">
        <span class="label">Aliquam tincidunt</span>
      </li>
    </ol>
  </div>
  <!-- End component -->
  
  <!-- Demo only -->
  <div class="controls">
    <button class="trigger">Toggle progress</button>
    <p>Click any point to navigate to it directly</p>
  </div>
</div>
              
            
!

CSS

              
                @import "compass/css3";

/**
 * Define variables
 */
$points        : 5;
$demo_w        : 90%;
$track_h       : 4px;
$track_h05     : $track_h / 2;
$gutter        : 100% / ($points - 1);
$duration      : 1s;

$_r    : 24px;
$_r05  : $_r / 2;
$_r025 : $_r05 / 2;
$_b    : $_r / 6;
$_mt   : ($track_h - $_r) * 0.5 - $track_h;

$tint-track      : #ddd;
$tint-progress   : red;
$tint-complete   : #777;
$tint-incomplete : lighten($tint-complete, 20%);


/**
 * Style default tags
 */
*, *:before, *:after {
  @include box-sizing(border-box);
}

html, body {
  height: 100%;
}

body {
  font-size: 14px;
  text-align: center;
}


/**
 * Utility styles
 */
.inliner {
  height: 100%;
}

.inliner,
.inliner + .inlined {
  display        : inline-block;
  vertical-align : middle;
}

.inlined {
  width: $demo_w;
}


/**
 * Component styles
 */
%progress-meter-demo {
  margin  : 20px auto 40px;
  padding : 40px;
}

.progress-meter {
  @extend %progress-meter-demo;
  
  counter-reset : point;
  
  %check {
    @include transition;
    @include border-radius($_r);
    @include box-shadow(0 0 0 2px white);
    
    content          : "\2713";
    display          : block;
    width            : $_r;
    margin           : 0 auto $_r05;
    border           : $_b solid $tint-incomplete;
    text-align       : center;
    background-color : white;
    color            : white;
  }
  
  .track {
    position   : relative;
    height     : $track_h;
    background : $tint-track;
  }
  
  .progress {
    @include transition(width 1s);
    
    display    : block;
    position   : absolute;
    left       : 0;
    top        : 0;
    width      : 0;
    height     : $track_h;
    background : $tint-progress;
  }
  
  .progress-points {  
    position   : relative;
    margin     : $_mt 0 0;
    padding    : 0;
    list-style : none;
    
    @for $i from 1 through $points {
      .progress-point:nth-child(#{$i}) {
        left: ($i - 1) * $gutter;
      }
    }
  }
  
  .progress-point {
    $_w : 100px;
    $_ml: $_w / -2;
    
    @include transition(color $duration);
    
    position    : absolute;
    display     : block;
    width       : $_w;
    margin-left : $_ml;
    text-align  : center;
    cursor      : pointer;
    color       : #999;
    
    &:before {
      @extend %check;
    }
    
    &.completed,
      &.active {
      color: $tint-complete;
    }
    
    &.completed:before {
      border-color     : $tint-complete;
      background-color : $tint-complete;
    }
    
    &.active:before {
      @include transition-delay($duration);
      
      border-color: $tint-complete;
    }
    
    .label:before {
      counter-increment: point;
      content: counter(point) ". "; /* Display the counter */
    }
  }
}

/**
 * Demo controls 
 */
.controls {
  text-align: center;
  font-size: 12px;
}

.trigger {
  $_tint-bg     : #bbb;
  $tint_text    : darken($_tint-bg, 35%);
  $_tint-shadow : lighten($_tint-bg, 25%);
    
  @include border-radius(3px);
  
  padding     : 6px 8px;
  border      : none;
  font        : 14px inherit;
  text-shadow : 0px 1px 1px rgba($_tint-shadow, 0.75);
  color       : $tint_text;

  @include background-image(
    linear-gradient($_tint-bg, darken($_tint-bg, 15%))
  ); 
}
              
            
!

JS

              
                (function() {  
  var $point_arr, $points, $progress, $trigger, active, max, tracker, val;

  $trigger   = $('.trigger').first();
  $points    = $('.progress-points').first();
  $point_arr = $('.progress-point');
  $progress  = $('.progress').first();

  val     = +$points.data('current') - 1;
  max     = $point_arr.length - 1;
  tracker = active = 0;

  function activate(index) {
    if (index !== active) {
      active       = index;
      var $_active = $point_arr.eq(active)
      
      $point_arr
        .removeClass('completed active')
        .slice(0, active).addClass('completed')
      
      $_active.addClass('active');
      
      return $progress.css('width', (index / max * 100) + "%");
    }
  };

  $points.on('click', 'li', function(event) {
    var _index;
    _index  = $point_arr.index(this);
    tracker = _index === 0 ? 1 : _index === val ? 0 : tracker;
    
    return activate(_index);
  });

  $trigger.on('click', function() {
    return activate(tracker++ % 2 === 0 ? 0 : val);
  });

  setTimeout((function() {
    return activate(val);
  }), 1000);

}).call(this);

              
            
!
999px

Console