Skip to content
Permalink
Browse files

slider: added animate option: can be simply set to true, or to a mult…

…iplier that makes the animation longer or shorter (higher = longer, shorter = faster)
  • Loading branch information
Paul Bakaus
Paul Bakaus committed Jul 3, 2008
1 parent 871092f commit c0710fb6b281bf1092ecab6f0c9febdcf06c6133
Showing with 5 additions and 3 deletions.
  1. +5 −3 ui/ui.slider.js
@@ -399,15 +399,16 @@ $.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) {
if(o.stepping.y) y = Math.round(y / o.stepping.y) * o.stepping.y;
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);

0 comments on commit c0710fb

Please sign in to comment.
You can’t perform that action at this time.