diff options
author | Scott González <scott.gonzalez@gmail.com> | 2009-02-17 01:39:25 +0000 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2009-02-17 01:39:25 +0000 |
commit | 55081dae775c1422552b5b580443e160fb99adf9 (patch) | |
tree | 5383bf33a0313bf5d822eac7c69aa6b930f95bf8 /ui | |
parent | 6754eaa33802e1c22269b827c91acf19c670f9ca (diff) | |
download | jquery-ui-55081dae775c1422552b5b580443e160fb99adf9.tar.gz jquery-ui-55081dae775c1422552b5b580443e160fb99adf9.zip |
Slider: Fixed divide by zero error when min and max are the same. Fixed #4155 - IE6 error by min==max.
Diffstat (limited to 'ui')
-rw-r--r-- | ui/ui.slider.js | 7 |
1 files changed, 6 insertions, 1 deletions
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); |