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

              
                ul.progress
  li#step-one.complete
    a step 1
  li#step-two.complete
    a step 2
  li#step-three.complete
    a ...
  li#step-four.active
    a profit
  li#step-five
    a confront troubling realities about the amorality of capitalism
    
              
            
!

CSS

              
                $background-color-incomplete: black
$background-color-active: teal
$background-color-complete: blue

$color-incomplete: white
$color-complete: white

$progress-bar-height: 35px
$progress-node-height: 100px

ul.progress
  list-style: none
  margin: auto
  height: $progress-node-height
  background-color: transparent

  display: flex
  justify-content: space-between

  li
    background-color: transparent
    display: flex
    align-items: center
    opacity: 0.5
    transition: 1s
    text-align: center

    &.active

      a
        background-color: $background-color-active
      
      &:not(:first-child)::before
        color: $color-complete
        background-color: $background-color-active
      
      &:not(:last-child)::after
        color: $color-complete
        background-color: $background-color-active

    a
      color: $color-incomplete
      background-color: $background-color-incomplete
      height: $progress-node-height
      width: $progress-node-height
      border-radius: 50%
      display: flex
      align-items: center
      justify-content: center
      transition: 1s
      cursor: pointer
      padding: 5px

    &:not(:last-child)::after
      content: ' '
      color: $color-incomplete
      background-color: $background-color-incomplete
      width: 5px
      height: $progress-bar-height
      margin-left: -5px
      transition: 1s

    &:not(:first-child)
      flex: 1

      &::before
        transition: 1s
        flex: 1
        content: ' '
        color: $color-incomplete
        background-color: $background-color-incomplete
        min-width: 1px
        height: $progress-bar-height
        margin-right: -5px

    &.complete
      opacity: 0.7

      a
        color: $color-complete
        background-color: $background-color-complete
      
      &:not(:first-child)::before
        color: $color-complete
        background-color: $background-color-complete
      
      &:not(:last-child)::after
        color: $color-complete
        background-color: $background-color-complete

              
            
!

JS

              
                $(document).ready(function(){
  $("a").click(function(){
    updateProgress($(this).closest('li').attr('id'));
  });
});

var updateProgress = function(clickedId) {
  console.log(clickedId);
  var progress_nodes = $('ul.progress li');
  
  for (i = 0, len = progress_nodes.length; i < len; i++) {

    if(progress_nodes[i].id.indexOf(clickedId) > -1){
      progress_nodes[i].classList.add('active');

      for (j = 0; j < len; j++) {
        if(j < i) {
          progress_nodes[j].classList.add('complete');
        } else {
          progress_nodes[j].classList.remove('complete');
        }
      }
    } else {
      progress_nodes[i].classList.remove('active');
    }
  }
}
              
            
!
999px

Console