range slider style : demo 1

0
0
0

HTML

                        
0

CSS

                        .range-slider{ margin: 50px 0 0 0; }
                        .range-slider input[type="range"]{
                            width: calc(100% - (68px));
                            height: 10px;
                            border-radius: 5px;
                            background: #d7dcdf;
                            outline: none;
                            float: left;
                            -webkit-appearance: none;
                        }
                        .range-slider input[type="range"]::-webkit-slider-thumb{
                            width: 20px;
                            height: 20px;
                            border-radius: 50%;
                            background: #2c3e50;
                            cursor: pointer;
                            transition: background .15s ease-in-out;
                            -webkit-appearance: none;
                            appearance: none;
                        }
                        .range-slider input[type="range"]::-webkit-slider-thumb:hover,
                        .range-slider input[type="range"]:active::-webkit-slider-thumb{ background: #4cb2ef; }
                        .range-slider input[type="range"]::-moz-range-thumb{
                            width: 20px;
                            height: 20px;
                            border: 0;
                            border-radius: 50%;
                            background: #2c3e50;
                            cursor: pointer;
                            transition: background .15s ease-in-out;
                        }
                        .range-slider input[type="range"]::-moz-range-thumb:hover,
                        .range-slider input[type="range"]:active::-moz-range-thumb{ background: #4cb2ef; }
                        .range-slider .range-value{
                            display: inline-block;
                            width: 60px;
                            background: #2c3e50;
                            border-radius: 3px;
                            padding: 5px 10px;
                            margin-left: 8px;
                            line-height: 20px;
                            color: #fff;
                            text-align: center;
                            position: relative;
                            top: -10px;
                        }
                        .range-slider .range-value:after{
                            content: "";
                            border-right: 7px solid #2c3e50;
                            border-top: 7px solid transparent;
                            border-bottom: 7px solid transparent;
                            position: absolute;
                            top: 8px;
                            left: -7px;
                        }
                        ::-moz-range-track{
                            background: #d7dcdf;
                            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');
                                        $(this).html(value);
                                    });
                                    range.on('input', function(){
                                        $(this).next(value).html(this.value);
                                    });
                                });
                            };
                            rangeSlider();
                        });
                    
License Terms