Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create multiple range slide handles in one slider

I am trying to add multiple handles to a jQuery UI slider widget, as in 2 or 3 or more range sliders in one slider.

I have tried searching on google and found an article that shows how to modify it to have multiple handles but I need them to work as range sliders.

Is there anyway to make this work?

$("#slider-range").slider({
    range: true,
    min: 0,
    max: 1439,
    values: [540, 1020],
    animate: true,
    slide: slideTime
});

Thanks

like image 377
hilarl Avatar asked Jun 16 '11 07:06

hilarl


4 Answers

colResizable is fine and all, but if you're looking for something a bit more modern, I wrote Elessar to fill this exact niche.

like image 132
Kara Brightwell Avatar answered Oct 19 '22 23:10

Kara Brightwell


Take a look at colResizable jQuery plugin. It allows you to resize table columns and also to create multiple range sliders:

like image 31
Alvaro Prieto Lauroba Avatar answered Oct 20 '22 00:10

Alvaro Prieto Lauroba


I did edit.

You can look to http://jsfiddle.net/q5WEe/1/

I did edit line 70 to 82.

            /*edit
            if ( o.values.length && o.values.length !== 2 ) {
                o.values = [ o.values[0], o.values[0] ];
            }*/
        }
        /*edit
        this.range = $( "<div></div>" )
            .appendTo( this.element )
            .addClass( "ui-slider-range" +
            // note: this isn't the most fittingly semantic framework class for this element,
            // but worked best visually with a variety of themes
            " ui-widget-header" +
            ( ( o.range === "min" || o.range === "max" ) ? " ui-slider-range-" + o.range : "" ) );*/
like image 3
misima Avatar answered Oct 20 '22 00:10

misima


This is a wrapper that extends jquery-ui slider functionality and allows to build multi-range slider http://jsfiddle.net/ladrower/BmQq4/

It is easy to use. Just pass the selector of DOM element that will contain a multi-range slider.

<html>
    <div id="slider"></div>
</html>

<script>
    var intervals = new Intervals("#slider");
</script>

Please, check out the documentation and sources at GitHub https://github.com/ladrower/jquery-ui-intervals

like image 5
Artem Platonov Avatar answered Oct 19 '22 22:10

Artem Platonov