Press "Enter" to skip to content

[Multicolor] Gradient Range Slider Control Made in Pure JS

Multicolor-Slider is a small JavaScript library to enhance and beautify the default range slider control with custom styles and add-ons.

gradient slider javascript, gradient range slider css, range slider linear-gradient, input range background gradient, color gradient slider, range slider with ticks css

  • Display the lower and upper bands in different colors.
  • Display the current value in a tooltip just above your thumb.
  • Separate and portable code and pattern, min/max values are easily configurable.

How to make use of it:

1. Create a regular range of input on the page.

<input id="slide" type="range" min="10" max="100" value="62" oninput="displayValue(event)" />

2. Create an inline element to display the current value.

<span id="val"></span>

3. You can also create controls to change the maximum/minimum values that are allowed to be selected.

<div class="form">
  <div>
    <label for="min">Lower bound</label>
    <input type="number" id="min" onkeydown="checkPostiveInteger(event)" oninput="checkValidLimits()" placeholder="  < and != upper bound">
  </div>
  <div>
    <label for="max">Upper bound</label>
    <input type="number" id="max" onkeydown="checkPostiveInteger(event)" oninput="checkValidLimits()" placeholder="  > and != lower bound">
  </div>
  <button onclick="changeLimits()" id="limitButton" disabled>Apply limits</button>
</div>

4. Apply your own CSS styles to the slider control.

input[type=range] {
  width: 100%;
  -webkit-appearance: none;
  margin: 0;
}
input[type=range]:focus { outline: none; }
input[type=range]::-webkit-slider-runnable-track {
 width: 100%;
 height: 19px;
 cursor: pointer;
 box-shadow: 0 4px 4px rgba(0,0,0,0.3) inset;
 background: linear-gradient(to right, #005fc2, #35A834 40%, #ffd400 65%, #FF6400);
 border-radius: 20px;
 border: 0.2px solid #010101;
}
input[type=range]::-webkit-slider-thumb {
 box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
 border: 1px solid #000000;
 height: 20px;
 width: 20px;
 border-radius: 20px;
 background: white;
 cursor: pointer;
 -webkit-appearance: none;
 margin-top: -1px;
}
#slide:before {
  content: attr(min);
  position: absolute;
  bottom: 0;
  left: 0;
  color: black;
  font-size: 1rem;
}
#slide:after {
  content: attr(max);
  position: absolute;
  bottom: 0;
  right: 0;
  color: black;
  font-size: 1rem;
}
#val {
  font-size: 1.6rem;
  position: absolute;
  left: 0;
  bottom: 40px;
  width: 100px;
}

gradient slider control, Multicolor-Slider Plugin/Github, webkit slider runnable track, html range slider with labels


See Demo And Download

Official Website(ogostos): Click Here

This superior jQuery/javascript plugin is developed by ogostos. For extra advanced usage, please go to the official website.

Be First to Comment

    Leave a Reply

    Your email address will not be published.