Skip to content

Commit 3342fb8

Browse files
committed
Slider: Fixed min and max range sliders to add ui-slider-range-min or ui-slider-range-max class and not set corresponding left/right/top/bottom inline, only width/height
(fixes #4182 - slider min/max classes aren't being added to range div) (fixes #3850 - Slider Range With Fixed Max Demo Bug in Opera)
1 parent bf43ab6 commit 3342fb8

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

ui/ui.slider.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,15 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, {
4646

4747
this.range
4848
.appendTo(this.element)
49-
.addClass("ui-slider-range"
50-
+ " ui-widget-header");
49+
.addClass("ui-slider-range");
5150

52-
(o.range == "min") && (this.orientation == "horizontal") && this.range.css({ left : 0 });
53-
(o.range == "max") && (this.orientation == "horizontal") && this.range.css({ right : 0 });
54-
(o.range == "min") && (this.orientation == "vertical") && this.range.css({ bottom : 0 });
55-
(o.range == "max") && (this.orientation == "vertical") && this.range.css({ top : 0 });
51+
if (o.range == "min" || o.range == "max") {
52+
this.range.addClass("ui-slider-range-" + o.range);
53+
}
54+
55+
// note: this isn't the most fittingly semantic framework class for this element,
56+
// but worked best visually with a variety of themes
57+
this.range.addClass("ui-widget-header");
5658

5759
}
5860

@@ -464,10 +466,10 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, {
464466
var _set = {}; _set[self.orientation == 'horizontal' ? 'left' : 'bottom'] = valPercent + '%';
465467
this.handle.stop(1,1)[animate ? 'animate' : 'css'](_set, o.animate);
466468

467-
(oRange == "min") && (this.orientation == "horizontal") && this.range.stop(1,1)[animate ? 'animate' : 'css']({ left: 0, width: valPercent + '%' }, o.animate);
468-
(oRange == "max") && (this.orientation == "horizontal") && this.range[animate ? 'animate' : 'css']({ left: valPercent + '%', width: (100 - valPercent) + '%' }, { queue: false, duration: o.animate });
469-
(oRange == "min") && (this.orientation == "vertical") && this.range.stop(1,1)[animate ? 'animate' : 'css']({ top: (100 - valPercent) + '%', height: valPercent + '%' }, o.animate);
470-
(oRange == "max") && (this.orientation == "vertical") && this.range[animate ? 'animate' : 'css']({ bottom: valPercent + '%', height: (100 - valPercent) + '%' }, { queue: false, duration: o.animate });
469+
(oRange == "min") && (this.orientation == "horizontal") && this.range.stop(1,1)[animate ? 'animate' : 'css']({ width: valPercent + '%' }, o.animate);
470+
(oRange == "max") && (this.orientation == "horizontal") && this.range[animate ? 'animate' : 'css']({ width: (100 - valPercent) + '%' }, { queue: false, duration: o.animate });
471+
(oRange == "min") && (this.orientation == "vertical") && this.range.stop(1,1)[animate ? 'animate' : 'css']({ height: valPercent + '%' }, o.animate);
472+
(oRange == "max") && (this.orientation == "vertical") && this.range[animate ? 'animate' : 'css']({ height: (100 - valPercent) + '%' }, { queue: false, duration: o.animate });
471473
}
472474

473475
},

0 commit comments

Comments
 (0)