aboutsummaryrefslogtreecommitdiffstats
path: root/ui/ui.slider.js
diff options
context:
space:
mode:
authorPaul Bakaus <paul.bakaus@googlemail.com>2008-07-03 15:31:36 +0000
committerPaul Bakaus <paul.bakaus@googlemail.com>2008-07-03 15:31:36 +0000
commitc0710fb6b281bf1092ecab6f0c9febdcf06c6133 (patch)
treed8b70ff6ab00c5b5c595ca5bef1b8928e5761ba4 /ui/ui.slider.js
parent871092fc7a7f0efebed054a5c202768fdf6f2f10 (diff)
downloadjquery-ui-c0710fb6b281bf1092ecab6f0c9febdcf06c6133.tar.gz
jquery-ui-c0710fb6b281bf1092ecab6f0c9febdcf06c6133.zip
slider: added animate option: can be simply set to true, or to a multiplier that makes the animation longer or shorter (higher = longer, shorter = faster)
Diffstat (limited to 'ui/ui.slider.js')
-rw-r--r--ui/ui.slider.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/ui/ui.slider.js b/ui/ui.slider.js
index a1c9f24c7..82645e3e0 100644
--- a/ui/ui.slider.js
+++ b/ui/ui.slider.js
@@ -399,7 +399,8 @@ $.widget("ui.slider", {
x = this.translateValue(x, "x");
x = this.translateLimits(x, "x");
x = this.translateRange(x, "x");
- this.currentHandle.css({ left: x });
+
+ o.animate ? this.currentHandle.animate({ left: x }, (Math.abs(parseInt(this.currentHandle.css("left")) - x)) * (!isNaN(parseInt(o.animate)) ? o.animate : 5)) : this.currentHandle.css({ left: x });
}
if(o.axis != "horizontal" && y !== undefined) {
@@ -407,7 +408,7 @@ $.widget("ui.slider", {
y = this.translateValue(y, "y");
y = this.translateLimits(y, "y");
y = this.translateRange(y, "y");
- this.currentHandle.css({ top: y });
+ o.animate ? this.currentHandle.animate({ top: y }, (Math.abs(parseInt(this.currentHandle.css("top")) - y)) * (!isNaN(parseInt(o.animate)) ? o.animate : 5)) : this.currentHandle.css({ top: y });
}
if (this.rangeElement)
@@ -432,7 +433,8 @@ $.ui.slider.getter = "value";
$.ui.slider.defaults = {
handle: ".ui-slider-handle",
- distance: 1
+ distance: 1,
+ animate: false
};
})(jQuery);