This time I will share jQuery Plugin and tutorial about Slim Custom Range Input Plugin With jQuery – html-input-range, hope it will help you in programming stack.
html-input-range is a jQuery plugin to create a slim, elegant, custom range slider from a standard HTML range input that enables the user to pick a number within a specific range.
How to use it:
1. Import the latest jQuery library together withe the jQuery html-input-range plugin’s JavaScript and Stylesheet into the document.
1 |
< link rel = "stylesheet" href = "html-input-range.css" > |
3 |
integrity = "sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" |
4 |
crossorigin = "anonymous" > |
6 |
< script src = "html-input-range.js" ></ script > |
2. Create a normal range input on the page.
1 |
< input type = "range" id = "html-input-range" > |
3. Initialize the plugin to create a custom range input from the range input.
1 |
$(document).ready( function () { |
2 |
htmlInputrange. default (); |
4. Enable/disable the tooltip that displays the current value when your drag the range slider.
1 |
$(document).ready( function () { |
2 |
htmlInputRange.options({ |
5. Set the max value.
1 |
$(document).ready( function () { |
2 |
htmlInputRange.options({ |
6. Override the default styles to create your own theme.
006 |
.html-inupt-range input[type= 'range' ] { |
007 |
-webkit-appearance: none ; |
011 |
box-shadow: 0 0 3px rgba( 0 , 0 , 0 , 0.24 ); |
017 |
.html-inupt-range input[type= "range" ]::-webkit-slider-thumb { |
018 |
-webkit-appearance: none ; |
021 |
box-shadow: 0 0 3px rgba( 0 , 0 , 0 , 0.24 ); |
022 |
background-image : linear-gradient(to bottom , #6c5ce7 0 , #6c5ce7 100% ); |
026 |
.html-input-range-custom input[type= 'range' ] { |
032 |
.html-input-range-custom .hir-tracker-bg, |
033 |
.html-input-range-custom .hir-tracker-bg::after, |
034 |
.html-input-range-custom .hir-tracker-bg::before { |
036 |
box-shadow: 0 0 3px rgba( 0 , 0 , 0 , 0.24 ); |
039 |
.html-input-range-custom .hir-tracker-bg { |
042 |
width : calc( 100% + 15px ); |
044 |
background-color : #a29bfe ; |
048 |
.html-input-range-custom .hir-tracker-bg::after, |
049 |
.html-input-range-custom .hir-tracker-bg::before { |
056 |
background-color : #fff ; |
057 |
border : 1px solid #a29bfe ; |
058 |
box-shadow: 0 0 3px rgba( 0 , 0 , 0 , 0.24 ); |
061 |
.html-input-range-custom .hir-tracker-bg::before { |
065 |
.html-input-range-custom .hir-tracker-bg::after { |
069 |
.html-input-range-custom .hir-tracker-thumb, |
070 |
.html-input-range-custom .hir-tracker-thumb::after { |
072 |
background-color : #6c5ce7 ; |
075 |
.html-input-range-custom .hir-tracker-thumb { |
079 |
height : 6px
source : jquery.net
|