.demo{ background-color: #333; } .range-slider{ padding: 15px 0 40px; margin: 0 0 10px 0; position: relative; } .range-slider input[type="range"]{ background: #555; width: 100%; height: 20px; border-radius: 3px; outline: none; -webkit-appearance: none; } .range-slider input[type="range"]::-webkit-slider-thumb{ background: transparent; width: 20px; height: 20px; border: 5px solid #26ffe5; border-radius: 50%; cursor: pointer; transition: all 0.15s ease-in-out 0s; -webkit-appearance: none; appearance: none; } .range-slider input[type="range"]::-webkit-slider-thumb:hover, .range-slider input[type="range"]:active::-webkit-slider-thumb{ background: #000; box-shadow: 0 0 10px #000; } .range-slider input[type="range"]::-moz-range-thumb{ background: transparent; width: 10px; height: 10px; border: 5px solid #26ffe5; border-radius: 50%; cursor: pointer; transition: all 0.15s ease-in-out 0s; } .range-slider input[type="range"]::-moz-range-thumb:hover, .range-slider input[type="range"]:active::-moz-range-thumb{ background: #000; box-shadow: 0 0 10px #000; } .range-slider .range-value{ color: #26ffe5; font-size: 20px; font-weight: 600; text-align: center; line-height: 35px; width: 60px; height: 35px; box-shadow: 0 0 5px -3px #26ffe5; border-radius: 50%; position: absolute; bottom: 0; right: 0; } ::-moz-range-track{ background: transparent; border: 0; }
$(document).ready(function(){ var rangeSlider = function(){ var slider = $('.range-slider'), range = $('.range-slider input[type="range"]'), value = $('.range-value'); slider.each(function(){ value.each(function(){ var value = $(this).prev().attr('value'); var max = $(this).prev().attr('max'); $(this).html(value); }); range.on('input', function(){ $(this).next(value).html(this.value); }); }); }; rangeSlider(); });