Opened 13 years ago

Closed 10 years ago

Last modified 10 years ago

#5602 closed bug (fixed)

Slider Does Not Exhibit Proper Behavior When Switching Range

Reported by: jashugan Owned by:
Priority: minor Milestone: 1.10.1
Component: ui.slider Version: 1.8.1
Keywords: Cc:
Blocked by: Blocking:

Description

When switching the range of a slider from min to max (or vice versa), the slider stops working correctly. For example, take this bit of code.

$("#MasterSlider").slider({range: "min", min: 1, max: 10, step: 1});

// later on...
$("#MasterSlider").slider('option', 'range', 'max')

When the range is set to "min", the filled portion of the bar appears on the left. When set to "max", the filled portion of the bar appears on the right. However, when switching from "min" to "max" on an existing slider, the behavior becomes unexpected in two ways.

  1. It doesn't update the filled region from left of the slider button to right of the slider button.
  2. When moving the slider button the filled area doesn't work properly. (see attached image).

Attachments (1)

Screen shot 2010-05-10 at 1.24.41 PM.png (4.2 KB) - added by jashugan 13 years ago.

Download all attachments as: .zip

Change History (11)

Changed 13 years ago by jashugan

comment:1 Changed 13 years ago by watanabe

It seems "changing option 'range'" is not implemented properly.

See:
jQuery UI 1.8.1 uncompressed version.
jquery.ui.slider.js

line 80(slider _create)

this.range.addClass( "ui-slider-range-" + o.range );

line 516(slider _setOption)

	switch ( key ) {
+		case "range":
+			this.range.removeClass( "ui-slider-range-min ui-slider-range-max");
+			if ( value === "min" || value === "max" ) {
+				this.range.addClass( "ui-slider-range-" + value );
+			}
+			break;
		case "disabled":

seems to work when switching the range of a slider from min to max (or vice versa),
not to work when from (to) true (false).

"this.range" should be rebuilded.

comment:2 Changed 13 years ago by Scott González

Milestone: TBD1.9

#4404 was closed as a duplicate.

comment:3 Changed 13 years ago by antix70517

Fix committed to http://github.com/lthibodeaux/jquery-ui/commit/12189f7

Somewhat sloppy on the commit message but I've been prodding for hours and it's late.

comment:4 Changed 13 years ago by antix70517

Reconciled some changes that were not mine with the code used to develop the fix. Final commit at:

http://github.com/lthibodeaux/jquery-ui/commit/898289a

comment:5 Changed 12 years ago by Scott González

#7412 is a duplicate of this ticket.

comment:6 Changed 10 years ago by Scott González

Milestone: 1.9.01.11.0

comment:7 Changed 10 years ago by tj.vantoll

Status: newopen

This is still an issue in 1.9: http://jsfiddle.net/tj_vantoll/rF2cr/.

comment:9 Changed 10 years ago by David Petersen

Resolution: fixed
Status: openclosed

Slider: allow range option to be changed. Fixed #5602 - Slider Does Not Exhibit Proper Behavior When Switching Range

Changeset: df077abfc2a236a373d2080a9ceae97bb48c2620

comment:10 Changed 10 years ago by Scott González

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