seiyria / bootstrap-slider

A slider control for Bootstrap 3 & 4.
http://seiyria.github.io/bootstrap-slider/
Other
3k stars 1.14k forks source link

Are there a solution for hold both slider handles in range option #924

Closed alonsoct00 closed 5 years ago

alonsoct00 commented 5 years ago

I need to apply a limit for both slider-handles in the range control, i.e. do not pass or cross each other... like the jquery slider UI that the both handles stops the slide behavior, and never cross.

https://jqueryui.com/slider/#range

I make a codepen with my code using bootstrap-slider

https://codepen.io/alonsoct00/pen/xojLdE

Thanks

seiyria commented 5 years ago

You would have to watch the slideStop event and return false if the values cross. You can check value[0] > value[1] in that function and it should work for your purposes.

alonsoct00 commented 5 years ago

Thanks

alonsoct00 commented 5 years ago

I updated my script but doesn't works

      $(this).on("slideStop", function() {
                var  rangeVal = $(this).val();
                var splitRange = rangeVal.split(',');
                var check0 = splitRange[0];
                var check1 = splitRange[1];
                 if (check0 == check1) {

                     return false;

                }
           });

please help me

seiyria commented 5 years ago

I saw you had opened a stackoverflows question so I will defer to that. Sorry!