range slider style : demo 38

0
0
0

HTML

                        
0

CSS

                        .range-slider{
                            margin: 50px 0 0 0;
                            position: relative;
                        }
                        .range-slider input[type="range"]{
                            background: #FFD700;
                            width: 100%;
                            height: 10px;
                            border-radius: 30px;
                            outline: none;
                            -webkit-appearance: none;
                        }
                        .range-slider input[type="range"]::-webkit-slider-thumb{
                            background: #555;
                            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{
                            background: rgba(0,0,0,0.5);
                        }
                        .range-slider input[type="range"]::-moz-range-thumb{
                            background: #555;
                            width: 20px;
                            height: 20px;
                            border: none;
                            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: rgba(0,0,0,0.5);
                        }
                        .range-slider .range-value{
                            color: #555;
                            font-size: 20px;
                            font-weight: 600;
                            text-align: center;
                            line-height: 37px;
                            width: 60px;
                            height: 37px;
                            border: 1px solid #555;
                            border-radius: 10px;
                            position: absolute;
                            top: -43px;
                        }
                        ::-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).css('left',((value / max * 100) - 4)+'%');
                                    });
                                    range.on('input', function(){
                                        $(this).next(value).html(this.value).css('left',((this.value / this.max * 100) - 4)+'%');
                                    });
                                });
                            };
                            rangeSlider();
                        });
                    
License Terms