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

              
                mixin range(controller, type)
  .range.row(ms-controller=controller)
    .col-xs-7.col-sm-10
      .range-container
        .range-track.progress
          .range-track-bar.progress-bar.progress-bar-striped.active(class='progress-bar-' + type ms-css-width='value + "%"')
        input.range-control(type='range' min='0' max='100' ms-duplex='value' ms-on-change='setValue')
    .col-xs-5.col-sm-2
      .range-popover.popover.right
        .arrow
        .popover-content
          input.form-control.input-lg.text-center(type='number' min='0' max='100' ms-duplex-number='value')

.container
  .jumbotron.hidden-xs.hidden-sm
    h1.text-center Bootstrap Ranges
    p.text-center
      | Based on 
      a(href='https://getbootstrap.com/' target='_blank') Bootstrap
      |  & 
      a(href='https://github.com/RubyLouvre/avalon/' target='_blank') AvalonJS
      | . Another  
      a(href='https://codepen.io/Cweili/pen/bNWyLw' target='_blank') Tip on Top edition
      | .
  each type in ['primary', 'success', 'danger', 'warning', 'info']
    +range('range-' + type, type)

              
            
!

CSS

              
                @import "nib"

$range-size = 16px

$range-track()
  background: none
  border: 0

$range-thumb()
  appearance: none
  width: $range-size * 2
  height: @width
  border-width: 0
  border-radius: 50%
  background: #f0f0f2 linear-gradient(#f0f0f2, #c2c3cb)
  box-shadow: rgba(#000, .5) 0 ($range-size / 4) ($range-size / 2)

.range
  position: relative
  margin-bottom: ($range-size / 2)
  &-container
    margin: $range-size 0 0
  &-track
    height: $range-size
    &-bar
      transition: none
  &-control
    appearance: none
    absolute: top 0 left 0
    padding: 0
    -moz-transform: translate(0, $range-size)
    background: transparent
    box-shadow: none
    cursor: pointer
    cursor: w-resize
    cursor: -webkit-grab
    cursor:    -moz-grab
    cursor:     -ms-grab
    cursor:         grab
    &:active
      cursor: -webkit-grabbing
      cursor:    -moz-grabbing
      cursor:     -ms-grabbing
      cursor:         grabbing
    &:focus
      outline: 0
    &::-ms-fill-lower
    &::-ms-fill-upper
    &::-ms-ticks-after
    &::-ms-ticks-before
    &::-ms-tooltip
      display: none
    &::-ms-track
      height: $range-size * 3
      color: transparent
      $range-track()
    &::-ms-thumb
      $range-thumb()
    &::-moz-range-track
      $range-track()
    &::-moz-range-thumb
      $range-thumb()
    &::-webkit-slider-runnable-track
      margin: ($range-size / 2) 0 0
      $range-track()
    &::-webkit-slider-thumb
      $range-thumb()
  &-popover
    display: block
    position: relative
    padding: 0
    .popover-content
      padding: 0
    .form-control
      border: 0
      box-shadow: none
      font-weight: bold
    
// Others

$h
  margin-top: 10px
    
body
  padding: 16px
  background: #e7e7e7
    
for i in 1..3
  h{i},
  .h{i}
    @extends $h
      
.container .jumbotron
  margin-bottom: 16px
  padding: 8px 0
              
            
!

JS

              
                [
  'primary'
  'success'
  'danger'
  'warning'
  'info'
].forEach (type) ->
  avalon.define
    $id: "range-#{type}"
    value: Math.round(Math.random() * 100)
    setValue: (e) ->
      e.preventDefault()
      # Fix the range won't update the value in IE
      @value = @value

              
            
!
999px

Console