Opened 15 years ago

Closed 15 years ago

Last modified 14 years ago

#2197 closed bug (fixed)

jqueryUI Slider plugin - Multiple handle BUG

Reported by: alexo Owned by: paul
Priority: major Milestone: 1.5
Component: ui.core Version: 1.2.2
Keywords: jquery ui plugin slider Cc: [email protected]
Blocked by: Blocking:


I'm using the demo code of the slider jquery-UI plugin to reproduce the bug. Below is a markup for a slider with multiple handle.

<div id='example3' class='ui-slider-2' style="margin: 40px;">
  <div class='ui-slider-handle'></div>
  <div class='ui-slider-handle' style="left: 188px;"></div>
<span id="slider-min"></span>
<span id="slider-max"></span>

Here the slider is constructed.

          minValue: 0,
          maxValue: 100,
          slide: function(e,ui) {
	    $("#slider-min").text( ui.values[0] );
	    $("#slider-max").text( ui.values[1] );

When the handler is moved, the span values are updated. The problem is that the second handler have the wrong value (0 instead of maxValue) when the first handler is moved for the first time.

Thank you!

Regards, Alex Objelean.

Change History (4)

comment:1 Changed 15 years ago by alexo

The problem seems to be the initialization of the curValue property in prepareCallbackObj function.


var func = function() {
        var retVal = [];
        for(var i=0;i<cur.interactions.length;i++) {
          retVal.push((cur.interactions[i].curValue || 0)+self.options.minValue);
        return retVal;

Here is my quick&dirty hack for this situation:

prepareCallbackObj: function(self,m) {
      var cur = this;
      var func = function() {
        var retVal = [];
        for(var i=0;i<cur.interactions.length;i++) {
          (i == 1 && cur.interactions[i].curValue == null)
             ? retVal.push(cur.interactions[i].curValue || self.options.maxValue)
             : retVal.push((cur.interactions[i].curValue || 0)+self.options.minValue);
        return retVal;

This is not quite a bug, but it proves that the slider plugin lacks startValues option for multiple handle slider.

Thank you! Regards, Alex Objelean

comment:2 Changed 15 years ago by paul

Resolution: fixed
Status: newclosed

Hi, this is fixed in the new version of slider, which works quite different. To get values for handles, you must call $(el).slider('value', handleIndex) to get the value. Good luck!

comment:3 Changed 15 years ago by (none)

Milestone: 1.2.3

Milestone 1.2.3 deleted

comment:4 Changed 14 years ago by paul

Milestone: 1.5
Note: See TracTickets for help on using tickets.