range slider style : demo 44

0
0
0

HTML

                        
0

CSS

                        .range-slider{
                            background-color: #e7e7e7;
                            padding: 5px 60px 13px 10px;
                            margin: 0 0 20px 0;
                            position: relative;
                        }
                        .range-slider input[type="range"]{
                            background: #8642db;
                            width: 100%;
                            height: 3px;
                            outline: none;
                            -webkit-appearance: none;
                        }
                        .range-slider input[type="range"]::-webkit-slider-thumb{
                            background: #8642db;
                            width: 20px;
                            height: 20px;
                            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{
                            box-shadow: 0 0 5px #8642db;
                        }
                        .range-slider input[type="range"]::-moz-range-thumb{
                            background: #8642db;
                            width: 20px;
                            height: 20px;
                            border-radius: 50%;
                            border: none;
                            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{
                            box-shadow: 0 0 5px #8642db;
                        }
                        .range-slider .range-value{
                            color: #fff;
                            background-color: #8642db;
                            font-size: 20px;
                            font-weight: 600;
                            text-align: center;
                            line-height: 38px;
                            height: 38px;
                            width: 50px;
                            transform: translateY(50%);
                            position: absolute;
                            bottom: 50%;
                            right: 0;
                        }
                        ::-moz-range-track{
                            background: transparent;
                            border: 0;
                        }
                    

JavaScript

(Range Slider depend on jQuery.)
                        

                        $(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();
                        });
                    
License Terms