range slider style : demo 2

0
0
0

HTML

                        
0

CSS

                        .range-slider{
                            margin: 55px 0 0 0;
                            position: relative;
                        }
                        .range-slider input[type="range"]{
                            width: 100%;
                            height: 10px;
                            border-radius: 5px;
                            background: #006aa4;
                            outline: none;
                            -webkit-appearance: none;
                        }
                        .range-slider input[type="range"]::-webkit-slider-thumb{
                            width: 15px;
                            height: 30px;
                            border-radius: 5px;
                            border: 1px solid #5a5a5a;
                            background: #fff;
                            box-shadow: 1px 1px 1px #000000, 0 0 1px #0d0d0d;
                            cursor: pointer;
                            transition: background .15s ease-in-out;
                            -webkit-appearance: none;
                            appearance: none;
                        }
                        .range-slider input[type="range"]::-moz-range-thumb{
                            width: 15px;
                            height: 30px;
                            border-radius: 5px;
                            border: 1px solid #5a5a5a;
                            background: #fff;
                            box-shadow: 1px 1px 1px #000000, 0 0 1px #0d0d0d;
                            cursor: pointer;
                            transition: background .15s ease-in-out;
                        }
                        .range-slider .range-value{
                            display: inline-block;
                            background: #006aa4;
                            border-radius: 3px;
                            padding: 5px 10px;
                            line-height: 20px;
                            color: #fff;
                            text-align: center;
                            position: absolute;
                            top: -35px;
                            left: 0;
                        }
                        ::-moz-range-track{
                            background: #006aa4;
                            border: 0;
                        }
                        .range-slider.red input[type="range"],
                        .range-slider.red .range-value{ background: #fe3e2f; }
                        .range-slider.red ::-moz-range-track{ background: #fe3e2f; }
                        .range-slider.green input[type="range"],
                        .range-slider.green .range-value{ background: #2fc77a; }
                        .range-slider.green ::-moz-range-track{ background: #2fc77a; }
                    

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