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

              
                %header#header
  %h1 
    RunPlan
  %button#reset Reset
  %div#feedback
    Progress 
    %div#progress
      %div#meter
%ol
  %li
    %span.label Week 1
    %ul.group
      - (1..3).each do |i|
        %li
          %strong 20 minutes
          Jog 1 min, Walk 1&frac12; mins <em>(Repeat)</em>
  %li
    %span.label Week 2
    %ul.group
      - (1..3).each do |i|
        %li
          %strong 20 minutes
          Jog 1&frac12; mins, Walk 2 mins <em>(Repeat)</em>
  %li
    %span.label Week 3
    %ul.group
      - (1..3).each do |i|
        %li
          %strong 18 minutes
          %ul.steps
            %li Jog 1&frac12; mins, Walk 1&frac12; mins
            %li Jog 3 mins, Walk 3 mins
            %li <em>(Repeat twice)</em>
  %li
    %span.label Week 4
    %ul.group
      - (1..3).each do |i|
        %li
          %strong 21&frac12; mins
          %ul.steps
            %li Jog 3 mins, Walk 1&frac12; mins
            %li Jog 5 mins, Walk 2&frac12; mins
            %li Jog 3 mins, Walk 1&frac12; mins
            %li Jog 5 mins
  %li
    %span.label Week 5
    %ul.group
      %li
        %strong 21 minutes
        %ul.steps
          %li Jog 5 mins, Walk 3 mins
          %li Jog 5 mins, Walk 3 mins
          %li Jog 5 mins
      %li
        %strong 21 minutes
        %ul.steps
          %li Jog 8 mins, Walk 5 mins
          %li Jog 8 mins
      %li
        %strong 20 minutes
        Jog 20 mins, no walking
  %li
    %span.label Week 6
    %ul.group
      %li
        %strong 24 minutes
        %ul.steps
          %li Jog 5 mins, Walk 3 mins
          %li Jog 8 mins, Walk 3 mins
          %li Jog 5 mins
      %li
        %strong 23 minutes
        %ul.steps
          %li Jog 10 mins, Walk 3 mins
          %li Jog 10 mins
      %li
        %strong 22 minutes
        Jog 22 mins, no walking
  %li
    %span.label Week 7
    %ul.group
      - (1..3).each do |i|
        %li
          %strong 25 minutes
          Jog 25 minutes
  %li
    %span.label Week 8
    %ul.group
      - (1..3).each do |i|
        %li
          %strong 28 minutes
          Jog 28 minutes
  %li
    %span.label Week 9
    %ul.group
      - (1..3).each do |i|
        %li
          %strong 30 minutes
          Jog 30 minutes
              
            
!

CSS

              
                body {
  font-family: 'Helvetica Neue', sans-serif;
  font-weight: 200;
  font-size: 100%;
  color: #5a5a5a;
}

#header {
  background: #fff;
  z-index: 2000;
  border-bottom: 1px solid #ccc;
  display: block;
  height: 74px;
  margin-bottom: 0;
  top: 0;
  width: 100%;
  position: fixed;
  
  button {
    position: absolute;
    top:0.5em;
    right: 0.5em;
  }
  
  h1 {
    line-height: 1em;
    margin: 0 0;
    padding: 12px 0.5em;
    font-size: 20px;
    font-weight: 300;
    width: auto;
  }
  
  @media (min-width: 320px) {
   text-align: center; 
  }
}

#feedback {
  padding: 7px 0.5em;
  display: block;
  background: #e8e8e8;
  border-top: 1px solid #ccc;
  border-bottom: 1px solid #ccc;
  text-align:left;
  box-shadow: inset 0 1px 1px #ccc;
    #progress {
      position: relative;
      display: inline-block;
      border: 1px solid #ccc;
      border-radius: 10px;
      height: 16px;
      width: calc(100% - 5.5em);
      margin: 0 0.5em;
      background: #fff;
      overflow: hidden;
      vertical-align: text-top;
      background-clip: border-box; /* Firefox 4, Safari 5, Opera 10, IE 9 */

      &:before,
      &:after {
          content: ' ';
          width: 1px;
          height: 100%;
          background: #ccc;
          position: absolute;
          left: 33.3333%;
          top: 0;
          z-index: 1;
      }
      
      &:after {
        left: 66.6666%;
      }
      
      #meter {
        background: #0af;
        height:100%;
        transition: all 0.3s ease-out;
     }
  }
}

.label {
  font-weight: 300;
  -webkit-position: sticky;
  position: sticky;
}

ol {
  list-style-type: none;
  padding: 1em 0 0;
  margin: 61px 0 0;
  clear:both;
  
  li {
    
    ul {

      list-style-type: none;
      padding-left: 0;
      margin: 0;
      
      li {
        border-bottom: 1px solid #ccc;
        padding: 0.5em;
        
        strong {
          color: #1a1a1a;
        }
        
      }
    }
  
    strong {
      display: block;
      font-weight: 400;
    }
  }
  
  .label {
    font-weight: 400;
    font-size: 14px;
    padding: 0 0.5em;
    display:block;
    line-height:24px;
    position: sticky;
    z-index: 1999;
    top: 77px;
    background: rgba(245,245,245,0.8);
    color: #1a1a1a;
    border-bottom: 1px solid #ccc;
  }
}

.group {
  > li {
    cursor: pointer;
    position:relative;
    padding-left: 3em;
    
    transition: opacity 0.6s;
    
    &.checked {
      opacity: 0.3;
    }
  }
}

.group {
  ul {
    li {
      border-bottom: none;
      padding: 0;
    }
  }
}

#finale {
  text-align: center;
  background: #f0f0f0;
  padding: 1em 0.5em;
  display: none;
  p {
    margin-top: 0;
  }
}


[data-checkov-theme="circle"] {
  .checkov-box { display: none; } 
  .checkov-label { 
    border: 1px dashed white; 
    position:absolute; 
    top:0.75em; 
    left: 0.5em; 
    background: #e2e2e2; 
    height: 2em; 
    width: 2em; 
    line-height: 2em; 
    text-align:center;
    color:white; 
    z-index:1000; 
    cursor: pointer; 
  }
  .checkov-box:checked + .checkov-label { 
    color: #3a3a3a;
  }
}
              
            
!

JS

              
                (function($){
  
  $.fn.checkov = function( options ){
    
    var settings = $.extend({ 
      callback: function(){},
      onChange: function(){}
    }, options);

    return $(this).each(function(n){
      if(!this.id) {
        this.id = 'checkov-list-'+n;
      }
      // add checkboxes
      $(this).children('li').each(function(i){
        var parentId = $(this).parent()[0].id;
        var checkovId = 'checkov-' + parentId + '-' + i;
        var checked = localStorage.getItem(checkovId) ? ' checked="checked"':'';
        var tmpl = '<input type="checkbox" class="checkov-box" id="'+checkovId+'" '+checked+'/><label for="'+checkovId+'" class="checkov-label">✓</label>';
        
        if(checked) { $(this).addClass('checked'); }
        
        $(this).append(tmpl).on('change', 'input[type="checkbox"]', function(e){
          
            var $target = $(e.target);
            if($target.is(':checked')) {
               localStorage.setItem(checkovId, true);
               $target.parent('li').addClass('checked');
            } else {
               localStorage.removeItem(checkovId, true);
               $target.parent('li').removeClass('checked');
            }
          
            settings.onChange();
          });
      });
    });
  };
})(jQuery);

// CHECKOV
$('ul.group').attr('data-checkov-theme', 'circle')
  .checkov({
    onChange: function(){
      updateProgress();
    }
  });

// Update Progress
var updateProgress = function(){
      var total = ( $('.checkov-box:checked').length / $('.checkov-box').length) * 100 +'%';
      $('#meter').css({
        'width': total
      });
      if(total === '100%') {
        $('#finale').show('slow');
      }
};

updateProgress();

$('#reset').on('click', function(){
  if(window.confirm('Are you sure you want to reset your progress?')) {
    $('.checkov-box:checked').trigger('click');
  }
});

$('.group > li').on('click', function(){
  $(this).find('.checkov-box').trigger('click');
});

var goToTop = $('.group > li:not(".checked")').eq(0).offset().top - $('#header').height() - 30;

window.scrollTo(0, goToTop) // first value for left offset, second value for top offset

              
            
!
999px

Console