123

Pen Settings

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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              .panel.panel-info
  .panel-heading
    h4.panel-title
      a(href="#collapsed-content" data-toggle="collapse")
        span.badge Select ranges
  .panel-collapse.collapse.in#collapsed-content
    .panel-body
      .sandbox-container.col-xs-12.col-sm-4#datepicker1
        span.badge.datepicker-toggler Base date
        .input-group
          input.form-control.datepicker-opener(type="text")
          .input-group-addon.datepicker-toggler
            span.glyphicon.glyphicon-th
      .sandbox-container.col-xs-12.col-sm-4#datepicker2
        span.badge.datepicker-toggler Compare date
        .input-group
          input.form-control.datepicker-opener(type="text")
          .input-group-addon.datepicker-toggler
            span.glyphicon.glyphicon-th
      .container.col-xs-12.col-sm-4
        .panel.panel-default
          .panel-heading
            h4.panel-title 
              span.badge Quick ranges
          .panel-body
            ul.nav.nav-pills.nav-stacked
              li.active
                a(href="#") Today
              li
                a(href="#") Last 7 days
              li
                a(href="#") Last 31 days
              hr
              li.dropdown
                a.dropdown-toggle(data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false") Save data 
                  span.caret
                ul.dropdown-menu
                  li.dropdown-header Comma separated
                    li.active
                      a(href="#" role="menuitem" tabindex="-1" download="data.csv") CSV
                  li.divider
                    li.dropdown-header MS Excel
                      li
                        a(href="#" role="menuitem" tabindex="-1" download="data.xlsx") XLSX

script(src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js")
script(src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js")
script(src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/js/bootstrap-datepicker.min.js")
script(src="https://www.gstatic.com/charts/loader.js")
            
          
!
            
              .datepicker-inline {
  border: 1px solid lightgrey;
  box-shadow: 2px 2px 10px lightgrey, 0 2px 10px lightgrey, -2px 0 10px lightgrey, -2px -2px 10px lightgrey;
  margin: 10px auto 0;
  border-radius: 2px;
}

.today, .clear, .datepicker-switch, .day, .month {
  transition: ease-out .3s;
  
  &:hover {
    transition: ease-in .3s;
  }
  
}

.datepicker-days, .datepicker-months, .datepicker-years, .datepicker-decades, .datepicker-centuries {
  animation: fadeIn .3s ease-in;
}

@keyframes fadeIn {
  from {opacity: 0;}
  to {opacity: 1;}
}

#datepicker1 .badge, #datepicker2 .badge {
  margin: 3px;
}
            
          
!
            
              $(document).ready( function() {

  // Datepicker
  setTimeout( function() {$(".datepicker-inline").css("display", "none")}, 1);
  
  $('.sandbox-container').datepicker({
      format: 'dd/mm/yyyy',
      startDate: 'd',
      clearBtn: true,
      todayBtn: true,
      disableTouchKeyboard: true,
      multidate: false,
      todayHighlight: true,
      weekStart: 1,
      calendarWeeks: true,
      keyboardNavigation: false,
  });

  function datepicker_toggler(datepickerId) {
    
    $(datepickerId + " .datepicker-toggler").click( function() {
      $(datepickerId + " .datepicker-inline").slideToggle();
    });

    $(datepickerId + " .datepicker-opener").click( function() {
      $(datepickerId + " .datepicker-inline").slideDown();
    });

    $(datepickerId + " .datepicker-days tbody").click( function() {
      $(datepickerId + " .datepicker-inline").slideUp();
    });
    
    // Keyboard
/*     $(datepickerId).keyup(function(e) {
      
      // Esc
      if (e.keyCode === 27) {
        $(datepickerId + " .datepicker-inline").slideUp();
      }
      
      // Enter
      if (e.keyCode === 13) {
        $(datepickerId + " .datepicker-inline").slideDown();
      }
      
    });
 */   
  }
  
  datepicker_toggler("#datepicker1");
  datepicker_toggler("#datepicker2");
  
  
})
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console