Can I place two thumbs in the slider?

I want to put two thumbs in a slider that shows a range of values ​​using CSS and HTML5. Please help me. Right now I have a slider with one thumb. I need a slider that has a different background with this range and two thumbs present in it. My code is here:

input[type=range] {
    border: 1px solid #4ba8b1;
    margin: 0px 0px 5px 5px;
    background:-webkit-gradient(linear,center top, center bottom, from(#CFDCDD),to(#DFE9EA),color-stop(50%,#DFE9EA));
    float:left;
    pointer:cursor;
    -webkit-appearance:none;
    width:300px;
    height:7px;
    -webkit-border-radius:5px;
    -moz-border-radius:5px;
}
input[type=range]:hover::-webkit-slider-thumb {     
    -webkit-appearance:none;
    background:url(images/Slider_v9.0_2.png);
    background-position:center;
    width:18px;
    height:27px;  
}

input[type=range]::-webkit-slider-thumb {     
    -webkit-appearance:none;
    background:url(images/Slider_v9.0_1.png);
    background-position:center;
    width:18px;
    height:27px;  
}


input[type=range]:active::-webkit-slider-thumb {     
    -webkit-appearance:none;
    background:url(images/Slider_v9.0_4.png);
    background-position:center;
    width:18px;
    height:27px;  
}

HTML:

<input type="range" min="0" max="150" value="30" />

Now placing two thumbs is what I want. I'm still looking for a background.

+3
source share
1 answer

html 5, firefox .. jquery, . , , , .

jquery

<meta charset="utf-8">
    <style>
    #demo-frame > div.demo { padding: 10px !important; };
    </style>
    <script>
    $(function() {
        $( "#slider-range" ).slider({
            range: true,
            min: 0,
            max: 500,
            values: [ 75, 300 ],
            slide: function( event, ui ) {
                $( "#amount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] );
            }
        });
        $( "#amount" ).val( "$" + $( "#slider-range" ).slider( "values", 0 ) +
            " - $" + $( "#slider-range" ).slider( "values", 1 ) );
    });
    </script>



<div class="demo">

<p>
    <label for="amount">Price range:</label>
    <input type="text" id="amount" style="border:0; color:#f6931f; font-weight:bold;" />
</p>

<div id="slider-range"></div>

</div><!-- End demo -->

>

0

Source: https://habr.com/ru/post/1796239/


All Articles