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.

            
              <center>
  <form id="eqRangeSlider">
    <fieldset>
      <input class="eq" type="range" name="range3" min="0" max="10" step="0.5" value="8" />
      <input class="eq" type="range" name="range3" min="0" max="10" step="0.5" value="3" />
      <input class="eq" type="range" name="range1" min="0" max="10" step="0.5" value="5" />
    </fieldset>
  </form>
</center>
            
          
!
            
              @import "compass/css3";

// HTML5 Range Sliders
// ---------------------------------
// Currently only supported in Webkit.
// Based on Equalizer by Jackie Tran Anh - 
// http://dribbble.com/shots/1143924-Equalizer

// Variables
// ---------------------------------
// Default
$body-background-color:         #aeb6bd !default;
// Form
$form-background-color:         #fff !default;
$form-box-shadow:               0 4px 2px rgba(0,0,0,0.075), 0 0 8px rgba(0,0,0,0.15) !default;
$form-width:                    256px !default;
$form-height:                   256px !default;
// Range
$range-background-color:        #46535f !default;
$range-color:                   #16C5DB !default;
$range-border-color:            #03519B !default;
$range-box-shadow:              -1px 0 1px rgba(0,0,0,0.25) inset, 0 -3px 0 rgba(0,0,0,0.1) inset;
$range-height:                  $form-height / 1.5 !default;
$range-width:                   16px !default;
$range-border-radius:           $range-width / 2 !default;
$range-thumb-background:        linear-gradient(left, #efefef, #fafafa) !default;
// Range - Thumb
$range-thumb-width:             $range-width * 4 !default;
$range-thumb-height:            $range-width * 2.5 !default;
$range-thumb-box-shadow:        1px 0 2px rgba(0,0,0,0.1), 1px 0 1px rgba(0,0,0,0.5) inset, -#{$range-thumb-height / 6} 0 #{$range-thumb-height / 8} rgba(0,0,0,0.15) !default;
$range-thumb-border:            1px solid rgba(0,0,0,0.25) !default;
// Range - Thumb - Overlay
$range-thumb-overlay-border:    2px solid rgba(0,0,0,0.1) !default;
$range-thumb-overlay-background:linear-gradient(left, #fff 0, #efefef 75%) !default;
$range-thumb-overlay-box-shadow:0 0 1px rgba(0,0,0,0.1) inset !default;
// Range - Thumb - Grip
$range-thumb-grip-background:   linear-gradient(left, transparent $range-thumb-width / 12, rgba(0,0,0,0.15) $range-thumb-width / 12, transparent $range-thumb-width / 12 + 1, transparent $range-thumb-width / 6, rgba(0,0,0,0.15) $range-thumb-width / 6 + 1, transparent $range-thumb-width / 6 + 1) !default;
$range-thumb-grip-border:       1px solid rgba(0,0,0,0.15) !default;

// Default
body {
  background-color: $body-background-color;
  padding: 0;
  margin: 0;
}

// Form
form {
  @include border-radius($form-width / 5);
  @include box-shadow($form-box-shadow);
  width: $form-width;
  height: $form-height;
  margin-top: 20px;
  background: $form-background-color;
    
  fieldset {
    position: relative;
    border: 0;
    margin: 0;
    padding: 0;
  }
}

// Range
.eq {
  @include transform(rotate(-90deg));
  @include border-radius($range-border-radius);
  @include box-shadow($range-box-shadow);
  float: right;
  position: relative;
  left: $range-width * 1.25;
  width: $range-height;
  height: $range-width;
  padding: 0;
  margin: #{$range-height / 1.5} 0 0 -#{$range-height / 1.625};
  background: $range-background-color;
  // Used in updateRangeOuput JS function as first gradient color
  color: #16C5DB;
  // Used in updateRangeOuput JS function as second gradient color
  border-color: #03519B;
  -webkit-appearance: none !important;
  outline: none;

  // Range - Thumb
  &::-webkit-slider-thumb {
    @include background($range-thumb-background);
    @include border-radius($range-thumb-width);
    @include box-shadow($range-thumb-box-shadow);
    position: relative;
    -webkit-appearance: none !important;
    width: $range-thumb-width;
    height: $range-thumb-height;
    border: $range-thumb-border;
    cursor: pointer;

  // Range - Thumb - Overlay and Grip
  &:before,
  &:after {
    position: absolute;
    content: ' ';
  }
  
  // Range - Thumb - Overlay
  &:before {
      @include background($range-thumb-overlay-background);
      @include border-radius($range-width);
      border-right: $range-thumb-overlay-border;
      @include box-shadow($range-thumb-overlay-box-shadow);
      margin: $range-width / 3 0 0 $range-width / 5;
      width: $range-thumb-width * 0.8375;
      height: $range-thumb-height * 0.6725;
    }
  
    // Range - Thumb - Grip
    &:after {
      @include background($range-thumb-grip-background);
      right: 50%;
      left: 50%;
      margin: #{$range-thumb-height / 3.5} 0 0 -#{$range-thumb-height / 5};
      width: $range-thumb-width / 4;
      height: $range-thumb-height / 2.5;
      border-left: $range-thumb-grip-border;
      border-right: $range-thumb-grip-border;
    }
  }
}
            
          
!
            
              $(function () {
  var $eq = $('.eq'),
      eqWidth = $eq.width(),
      eqHeight = $eq.height(),
      eqBackgroundColor = $eq.css('background-color'),
      eqGradientColor1 = $eq.css('color'),
      eqGradientColor2 = $eq.css('border-color');
 
  // Get current range value, calculate new height and update background gradient  
  function updateRangeOutput (range) {
    var currentRangeHeight = Number(range.val() / range.attr('max')) * eqWidth + 'px';

    return range.css('background', '-webkit-linear-gradient(left, ' + eqGradientColor1 + ' 0, ' + eqGradientColor2 + ' ' + currentRangeHeight + ', ' + eqBackgroundColor + ' ' + currentRangeHeight + ', ' + eqBackgroundColor + ' ' + eqHeight + 'px)');
  };
  
  // On load or change of input range value 
  $eq.each(function () {
    updateRangeOutput($(this));
  });
 
  $eq.change(function () {
    updateRangeOutput($(this));
  });
  
});
            
          
!
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