r2086 - trunk/ui

r2086 - trunk/ui


Author: scott.gonzalez
Date: Mon Feb 16 17:39:25 2009
New Revision: 2086
Modified:
trunk/ui/ui.slider.js
Log:
Slider: Fixed divide by zero error when min and max are the same. Fixed
#4155 - IE6 error by min==max.
Modified: trunk/ui/ui.slider.js
==============================================================================
--- trunk/ui/ui.slider.js    (original)
+++ trunk/ui/ui.slider.js    Mon Feb 16 17:39:25 2009
@@ -466,7 +466,12 @@
                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);