From 55081dae775c1422552b5b580443e160fb99adf9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Scott=20Gonz=C3=A1lez?= Date: Tue, 17 Feb 2009 01:39:25 +0000 Subject: [PATCH] Slider: Fixed divide by zero error when min and max are the same. Fixed #4155 - IE6 error by min==max. --- ui/ui.slider.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ui/ui.slider.js b/ui/ui.slider.js index ed00d282e..75109b7f4 100644 --- a/ui/ui.slider.js +++ b/ui/ui.slider.js @@ -466,7 +466,12 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, { lastValPercent = valPercent; }); } else { - var valPercent = (this.value() - this._valueMin()) / (this._valueMax() - this._valueMin()) * 100; + var value = this.value(), + valueMin = this._valueMin(), + valueMax = this._valueMax(), + valPercent = valueMax != valueMin + ? (value - valueMin) / (valueMax - valueMin) * 100 + : 0; var _set = {}; _set[self.orientation == 'horizontal' ? 'left' : 'bottom'] = valPercent + '%'; this.handle.stop(1,1)[animate ? 'animate' : 'css'](_set, o.animate); -- 2.39.5