Opened 11 years ago

Closed 11 years ago

#4434 closed bug (notabug)

Slider moveTo function with two handles with different ranges moves slider to wrong place

Reported by: kape Owned by:
Priority: minor Milestone: 1.8
Component: ui.slider Version: 1.5.3
Keywords: moveTo Cc:
Blocked by: Blocking:

Description

I have a slider with two handles, say cool and heat. Cool has range min: 58, max: 92, and heat has range: min 45, max: 65. In the slider options I declare cool first then heat in the handles array. Then when I call the moveTo function on the cool handle with a value higher than 65, the handle moves to 65.

On line 260 var handle = this.options.handles[this.handleIndex()]; chooses the handle, but the function handleIndex() looks for the handle in the handle object NOT in the options.handles array, and in the case above, handle[1] = cool but options.handles[0] = cool.

I've changed line 260 to this.handle[this.handleIndex()]; and the moveTo is working fine, but the slide goes past the min/max now.

Change History (4)

comment:1 Changed 11 years ago by kape

I couldn't find the following in the documentation, and perhaps it should be added to prevent other people from having the same issue as me.

In the HTML the two sliders were in declared in the reverse order as in the slider options. Perhaps this is obvious to some, but it wasn't to me. So anyway, the HTML slider elements have to be declared or appear in the HTML in the same order in which the slider.options.handles are declared.

comment:2 Changed 11 years ago by Jörn Zaefferer

Milestone: TBD1.7.2

Looks like a documentation issue.

comment:3 Changed 11 years ago by Jörn Zaefferer

Milestone: 1.7.21.8

comment:4 Changed 11 years ago by rdworth

Resolution: invalid
Status: newclosed

The slider was completely refactored in version 1.7. The moveTo function no longer exists.

Note: See TracTickets for help on using tickets.